SharePoint - Users Task webpart in Home Page

Asked By Venkatesh Suragana
23-Feb-09 02:27 AM
Hi,

            I am trying to display the current users task webpart in home page. But it should not shows any tasks for the current User in home page.
         I have a list in http://sharepoint:231/software/documents/default.aspx,  and I am adding users task webpart in home page;  http://sharepoint:231/  ,   but the user task webpart does not shows any tasks for the current user.
         When I am add the same webpart in
http://sharepoint:software/, there the webpart is work fine.

             I need the same webpart in home page and that will display all the tasks from different substes,  How can I do that.


Thanks
 

Check scope  Check scope

23-Feb-09 06:33 AM
I think u have to think about the scope of the feature

TRY THIS  TRY THIS

23-Feb-09 07:04 AM

Here is the source code for the base version.

using System;

using System.Collections.Generic;

namespace sa.WebParts.WebPartToDisplayGroupTasks{ [DefaultProperty("Text"),ToolboxData("<{0}:SPWebPart runat=server></{0}:SPWebPart>"),

XmlRoot(Namespace = "sa.WebParts.WebPartToDisplayGroupTasks")]public class SPWebPart : Microsoft.SharePoint.WebPartPages.WebPart

{private const EnumStatus _defaultStatus = EnumStatus.NotCompleted;private EnumStatus _enumStatus = _defaultStatus;

GridView GridView1 = new GridView();public enum EnumStatus

{NotStarted = 0,

InProgress = 1,

Completed=2,

NotCompleted=3

}

[Browsable(true),Category("Configuration"),

DefaultValue(EnumStatus.NotCompleted),WebPartStorage(Storage.Personal),

FriendlyName("Status"),Description("Select Status.")]

public EnumStatus Status{get { return _enumStatus; }set

{_enumStatus = value;}}

public SPWebPart(){

this.Title = “Webpart to display Group Tasks”;} protected override void CreateChildControls(){Microsoft.SharePoint.SPList listSiteSetup = SPContext.Current.Web.Lists["Tasks"];Microsoft.SharePoint.SPQuery query = new Microsoft.SharePoint.SPQuery();Microsoft.SharePoint.

SPListItemCollection items = listSiteSetup.Items;DataTable dtTasks = items.GetDataTable();

DataColumn dtLink = new DataColumn(“link”);dtTasks.Columns.Add(dtLink);//Columns to Display

string[] link = new string[1];link[0] = “link”;

HyperLinkField hlfTitle = new HyperLinkField();hlfTitle.DataTextField = “Title”;hlfTitle.HeaderText =

“Title”;hlfTitle.DataNavigateUrlFields = link;BoundField bfStatus = new BoundField();bfStatus.HeaderText = “Status”;bfStatus.DataField =

“Status”;BoundField bfStartDate = new BoundField();bfStartDate.DataField =

“StartDate”;bfStartDate.HeaderText = “Start Date”;

BoundField bfDueDate = new BoundField();bfDueDate.HeaderText = “Due Date”;bfDueDate.DataField =

“DueDate”;BoundField bfAssignedTo = new BoundField();bfAssignedTo.DataField =

“AssignedTo”;bfAssignedTo.HeaderText = “Assigned To”;GridView1.Columns.Add(hlfTitle);GridView1.Columns.Add(bfStatus);

GridView1.Columns.Add(bfStartDate);

GridView1.Columns.Add(bfDueDate);

GridView1.Columns.Add(bfAssignedTo);

GridView1.AutoGenerateColumns = false;foreach (DataRow dr in dtTasks.Rows){ dr["link"] = SPContext.Current.Web.Url + “/Lists/Tasks/DispForm.aspx?ID=” + Convert.ToString(dr["ID"]) + “&Source=” + SPContext.Current.Web.Url;}SPUser user = SPContext.Current.Web.CurrentUser;

string rowFilter = “AssignedTo = ‘” + user.Name + “‘”;SPGroupCollection userGroupsColle = user.Groups;

foreach (SPGroup grp in userGroupsColle){ rowFilter = rowFilter + ” OR AssignedTo = ‘” + grp.Name + “‘”;}string statusFilter = null;DataView dv = new DataView(dtTasks, rowFilter, null, DataViewRowState.CurrentRows);

switch (Status){case EnumStatus.NotCompleted:{statusFilter =

“Status=’In Progress’ OR Status=’Not Started’”;break;}case EnumStatus.Completed:statusFilter =

“Status=’Completed’”;break;

case EnumStatus.InProgress:statusFilter = “Status=’In Progress’”;

break;case EnumStatus.NotStarted:statusFilter =

“Status=’Not Started’”;break;

default:break;}dv = new DataView(dv.ToTable(), statusFilter, null, DataViewRowState.CurrentRows);

Label Label1 = new Label();Label1.Text = “There are no tasks to be completed by you or your group”;GridView1.DataSource = dv.ToTable();GridView1.DataBind();

if (dv.ToTable().Rows.Count == 0){ Label1.Visible = true;}else

Label1.Visible = false; this.Controls.Add(GridView1);this.Controls.Add(Label1);

base.CreateChildControls();}}

}

The approach is very obvious from the code above: yet again here it is in short:

1. Fetch the tasks from the tasks list.

2.Get the datatable version of tasks.

3.Decide on the columns to be shown and get the data from the datatable.

4.Apply necessary filters to the data ( Assigned to equal to Current user or current users groups.

5.Render the grid view control after binding the datasource.

6.THERE YOU Go!

7.There is Status filter also, which is a cusmizable property of the webpart and can be set to Completed, Not completed, In progress or Not started.

TRY THIS  TRY THIS

23-Feb-09 07:05 AM
The webpart list will change based upon the page layout you are using. Are you clicking on the "Advanced Web Part gallery and options" link in the bottom of the window?
thanks for reply  thanks for reply
23-Feb-09 07:49 AM
 Exactly, I looking for change the scope to site collection.  How can I do that.

Thanks
Thanks for quick reply  Thanks for quick reply
23-Feb-09 07:51 AM

              I am was searched in Advanced Web Part gallery but I do not find the exact one, how can I do that, how can I change the feature from web to site collecton
Create New Account
help
the right permissions on the content type. Then, I created a column "external data" in Sharepoint that I linked to my content type. When I want to change the data in EventID Level Message Correlation 11 / 13 / 2011 00:08:30.31 w3wp.exe (0x1D9C) 0x1038 SharePoint Foundation Monitoring nasq Medium Entering monitored scope (Request (GET:http: / / tricoflex:80 / CRM / _layouts / FldNewEx Cust%2E%20Relation%20ID&DescriptionParam = &VldFormulaParam = &VldMessageParam = )) 11 / 13 / 2011 00:08:30.31 w3wp.exe (0x1D9C) 0x1038 SharePoint Foundation Logging Correlation Data xmnv Medium Name = Request (GET:http: / / tricoflex:80 / CRM / _layouts / FldNewEx e307-4c5d-b470-c4351e5dff53 11 / 13 / 2011 00:08:30.32 w3wp.exe (0x1D9C) 0x1038 SharePoint Foundation Logging Correlation Data xmnv Medium Site = / 9694064f-e307-4c5d-b470-c4351e5dff53 11 / 13 / 2011 00:08:30.35 w3wp.exe (0x1D9C) 0x1038 SharePoint Foundation Monitoring b4ly Medium Leaving Monitored Scope (Request (GET:http: / / tricoflex:80 / CRM / _layouts / FldNewEx e307-4c5d-b470-c4351e5dff53 11 / 13 / 2011 00:08:30.45 wsstracing.exe (0x06A0) 0x17A0 SharePoint Foundation Unified Logging Service b9wt High Log retention limit reached. Log file 'C: \ Program Files log' has been deleted. 11 / 13 / 2011 00:08:30.45 wsstracing.exe (0x06A0) 0x17A0 SharePoint Foundation Tracing Controller Service 8096 Information Usage log retention limit reached. Some old usage log files have been deleted. 11 / 13 / 2011 00:08:30.57 w3wp.exe (0x1D9C) 0x1038 SharePoint Foundation Monitoring nasq Medium Entering monitored scope (Request (GET:http: / / tricoflex:80 / SiteAssets / SitePages / Accueil
project con sharepoint SharePoint SharePoint Portal Server Dev Discussions Sharepoint (1) Laurent (1) Cotton (1) Conectarme (1) Intentar (1) Liliana (1) Error (1) Project (1 Laurent Cotton www.bewise.fr es un error que sale al intentar conectarme con el sharepoint keywords: project, con, sharepoint description: !- - Web.Config configuration File- - configuration system.web customErrors mode = On deafaultRedirect = mycustompage.htm system
access into sharepoint SharePoint Sharepoint is new to my organisation and we are on the verge of deploying it to and import those? How have others resolved this issue? Your help is most appreciated, Matt SharePoint Discussions SharePoint (1) InfoPath (1) WSS 3.0 and MOSS 2007 (you didn't say which SharePoint product *and version* you were asking about) allow you with Access 2007 to synchronize (in both directions) Access tables and SharePoint Lists. It probably works in both directions (with some restrictions on field types used) although and then open that file using the template you created in InfoPath. keywords: access, into, sharepoint description: Sharepoint is new to my organisation and we are on the verge of deploying
Office SharePoint, Windows SharePoint and SharePoint Portal SharePoint Hi, I am a novice about SharePoint. Can anybody tell me if Office SharePoint, Windows SharePoint and SharePoint Portal are same thing? same server application? or what is the different among them? Thanks