This WebPart is developed get all the Task which are added in a Decision Meeting Workspace template selected. since SharePoint does not provide any out-Of-Box functionality to segregate this vital information.
hence a custom WebPart was developed by my associate.
Initially all the related reference /namespaces are added , despite of Microsoft.sharepoint;
We also be needing :
using Microsoft.SharePoint.Administration;
using Microsoft.SharePoint.WebControls;
using Microsoft.SharePoint.WebPartPages;
using Microsoft.SharePoint.Meetings;
//Core Code for WebPart.
public class MeetingWorkspace : System.Web.UI.WebControls.WebParts.WebPart
{
//Initilization
SPGridView m_grid;
SPWeb web1 = SPContext.Current.Web;
ObjectDataSource objDataSource = new ObjectDataSource();
//Override Methods
protected override void CreateChildControls()
{
try
{
Type type = this.GetType();
objDataSource.ID = "mTaskDS";
objDataSource.TypeName = type.AssemblyQualifiedName;
objDataSource.SelectMethod = "GetListItems";
objDataSource.ObjectCreating += new ObjectDataSourceObjectEventHandler(objDataSource_ObjectCreating);
this.Controls.Add(objDataSource);
#region SPGridView Details
m_grid = new SPGridView();
m_grid.AutoGenerateColumns = false;
m_grid.Columns.Clear();
HyperLinkField meetingName = new HyperLinkField();
meetingName.HeaderText = "Meeting Name";
meetingName.DataTextField = "MeetingName";
string[] strmeetingName = { "MeetingSiteUrl" };
meetingName.DataNavigateUrlFields = strmeetingName;
meetingName.DataNavigateUrlFormatString = "{0}";
m_grid.Columns.Add(meetingName);
BoundField t = new BoundField();
t.DataField = "Title";
t.HeaderText = "Task Title";
m_grid.Columns.Add(t);
BoundField b = new BoundField();
b.DataField = "Status";
b.HeaderText = "Status";
b.HtmlEncode = false;
b.SortExpression = "Status";
m_grid.Columns.Add(b);
BoundField colStartDate = new
BoundField();
colStartDate.DataField = "StartDate";
colStartDate.HeaderText = "Start Date";
colStartDate.HtmlEncode = false;
m_grid.Columns.Add(colStartDate);
BoundField colDueDate = new
BoundField();
colDueDate.DataField = "DueDate";
colDueDate.HeaderText = "Due Date";
colDueDate.HtmlEncode = false;
m_grid.Columns.Add(colDueDate);
m_grid.DataSourceID = "mTaskDS";
m_grid.AllowGrouping = true;
m_grid.AllowGroupCollapse = true;
m_grid.GroupField = "MeetingName";
m_grid.GroupFieldDisplayName = "MeetingName";
m_grid.AllowSorting = true;
m_grid.AllowPaging = true;
Controls.Add(m_grid);
m_grid.DataBind();
m_grid.PageSize = 3;
m_grid.PageIndexChanging += new GridViewPageEventHandler(m_grid_PageIndexChanging);
m_grid.PagerTemplate = null;
#endregion
base.CreateChildControls();
}
catch(Exception ex) { //Error }
}
//Data View Method
public DataView GetListItems()
{
DataView dv = new DataView();
DataTable dt = new DataTable();
try
{
string rowFilter = "AssignedTo = '" + SPContext.Current.Web.CurrentUser.Name + "'";
foreach (SPWeb web in web1.Webs)
{
if (SPMeeting.IsMeetingWorkspaceWeb(web))
{
SPMeeting meeting = SPMeeting.GetMeetingInformation(web);
// A Meeting Workspace has a Meeting Series list with information about all meetings in the workspace.
SPList meetings = web.Lists["Meeting Series"];
// Get the meeting items that fit the criteria.
SPListItemCollection items = meetings.Items;
// Now extract useful information about each meeting.
foreach (SPListItem item in items)
{
int instanceID = (int)item["InstanceID"];
SPQuery query =new SPQuery();
query.MeetingInstanceId = instanceID;
query.Query = @"<Query> <Where><IsNotNull> <FieldRefName='ID' /> </IsNotNull></Where></Query>" ;
SPList list = web.Lists["Tasks"];
DataTable dtMItems = list.GetItems(query).GetDataTable();
if (dtMItems.Columns["MeetingName"] == null)
{
dtMItems.Columns.Add("MeetingName");
dtMItems.AcceptChanges();
}
if (dtMItems.Columns["MeetingSiteUrl"] == null)
{
dtMItems.Columns.Add("MeetingSiteUrl");
dtMItems.AcceptChanges();
}
foreach (DataRow dr in dtMItems.Rows)
{
dr["MeetingName"] = item.Title;
dr["MeetingSiteUrl"] = web.Url + "/default.aspx?InstanceID=" + instanceID.ToString();
dtMItems.AcceptChanges();
}
dt.Merge(dtMItems);
} } }
dv = new DataView(dt, rowFilter, null, DataViewRowState.CurrentRows);
}
catch (Exception ex) {//Error}
return dv;
}
//Handler
private void objDataSource_ObjectCreating(object sender, ObjectDataSourceEventArgs e)
{
e.ObjectInstance = this;
}
private void m_grid_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
try
{
m_grid.PageIndex = e.NewPageIndex;
m_grid.AllowGrouping = true;
m_grid.AllowGroupCollapse = true;
m_grid.GroupField = "MeetingName";
m_grid.GroupFieldDisplayName = "MeetingName";
m_grid.DataBind();
}
catch (Exception ex) {//Error }
}
}
Addin Your Comments for the Same.
Special Thanks: Ganesh Bankar
SGS Cinema Portal | India And World
ReplyDeleteTitle: World Cinema News, Update News, Actor And Actress Wallpapers, Biography, Profile, Upcoming Films, Filmography
This blog is fully dedicated for tamil cinema news, videos, songs etc... Tamil, movies, news, headlines, gossip, entertainment, videos, songs, music, Tamil trailers, Tamil videos, Tamil mp3, Tamil actress,Tamil actors, Tamil movies reviews,Tamil movie reviews,Tamil movie previews,Tamil songs, Tamil music, Tamil top 10, Tamil movie gallery,Tamil mp3,bakthi,Tamil films,latest Tamil movies and more
Regards,
sgscinema.com
www.sgscinema.com
india