.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Setting custom task list permissions

Posted By:      Posted Date: December 04, 2010    Points: 0   Category :SharePoint

I am trying to use code to set permissions for a custom task created in Windows WF. I have been trying to use the following method to access a specific task in the task list and add a role to that task:

        public void setTaskPermissions(Guid taskGUID, string loginName)
            SPSite Site = new SPSite(ConfigurationManager.AppSettings["DefaultSourceURLStandard"]); 

            SPWeb Web = Site.OpenWeb();

            //Get Role Definition from SPWeb

            SPRoleDefinition RoleDefinition = Web.RoleDefinitions.GetByType(SPRoleType.Contributor); //or whichever SPRoleType you choose

            //Get SPListItem

            SPList List = Web.Lists[ConfigurationManager.AppSettings["LeaversTaskListName"]]; //e.g., "Announcements"
            SPListItem ListItem = List.Items[taskGUID];

            //Create new Role Assignment
            //Add Role Definition to Role Assignment's Role Definition Bindings

            //add role specific to user
            SPRoleAssignment specificRole = new SPRoleAssignment(loginName,"","","");

View Complete Post

More Related Resource Links

Help with Workflow Task List Permissions

Here's the scenario:  I have a workflow that is assigned (in parallel) to a series of people.  I've limited each person's permissions within the Workflor Task list to strictly edit by creating a custom permissions level.  So now workflow participants are able to Approve the workflow task, but cannot delete the item.  However, now, I wish to limit the tasks a user can approve to only the items that are assigned to them.    I assumed that the (Workflow Task List > List Settings > Advanced Settings >  Item Level Permissions > Edit access: Specify which items users can edit) set to 'Only their own' would do the trick, but that setting doesn't seem to impose any limitation on which task item a user can edit.    Oddly enough, when I set the (Read access:  Specify which items users can read) to 'Only their own' I loose access to every single item in the task list; even the ones that are assigned to me.  What gives?  I thought maybe SharePoint's interpretation of 'their own' possession was linked to who created the item instead of who it's assigned to, but these 2 behaviors don't seem to support that theory at all.    Is this a bug in SharePoint because I'm stumped.   Thanks! -Tracy

Setting permissions to Items/Views in a list

I have a list containing 2 FY's data. I need to make one of the FY year's data as read-only. Can i create a view filtering only this data and make only this view as read-only or do i need to edit permissions of individual items of the filtered FY and set it as read-only. Is there any other way of doing this?

BCS Method Security / External Content Type Permissions / Custom List Security Provider / Security T


I have an external list setup with the usual CRUD methods.  The external SQL table is also being populated by another source.  I want to enable/disable deleting depending on whether the record was created from SharePoint.  I would also like the normal list permissions to work.  So if a user has permissions to delete on the list, they can only delete items created for SharePoint. 

Where should this logic be incorporated?  On the BCS Delete method, somewhere in the External Content Type or on the list instance?  Most examples I find relate to security trimming for search.  I'm only concerned about the delete method.

I'm sure there are multiple ways to accomplish this.  Which is the best?


task item not able to update custom list item


I have a site with NT authenticated users with READ permission only.

  • I have custom list 1 with disinherited permissions where users can add items. A column in this list captures the name of the persons Manager (person or Group). e.g item created by Person X
  • WorkFlow runs and copies the item from custom list 1 to custom list 2
  • Custom List 2 with disinherited permissions. The item continues to have Person X in the 'created by' column
  • WorkFlow runs on Custom List 2 assigning only contribute permission on Custom List 2 to the Manager entered in the item. Person X has no access to the item in Custom List 2
  • The WorkFlow has  a Collect Data From User task to be completed by the Manager. The WF runs and creates the Task in the task list. I've noticed that this item in the task list is created by Person X!
  • The Manager completes the Task successfully. Then Custom List 2 is supposed to get updated with the values the manager set in the Task.
  • The Manager has contribute permission on the item in Custom List 2, so they should be able to update the item, but the WF fails with either Access Denied, or unable to find item or some such.

Setting Task Field Values in Custom .aspx Edit Form and accessing through ExtendedProperties


Since we're using WSS 3.0 and not MOSS 2007, we have to create and use ASP forms for any custom Workflow Task Edit pages instead of being able to use InfoPath forms (which would be nice...maybe some day we'll step up to MOSS). The custom Workflow Edit Pages are used for custom Task Content Types that we create so that our Workflow Tasks can have additional fields beyond the standard Workflow Task fields. Once you've collected the values for the Task fields from the user on the ASP Workflow Task Edit form, the typical procedure is to create a hashtable and fill the hashtable with key/value pairs that represent the names of your Task fields and their associated values, as such:

// This function is called when the user clicks the Save/Submit button
// on the Custom Task Edit ASP form
public void btnSubmit_Click(object sender, EventArgs e)
  // Create a hashtable that will be used to update the values of task fields
  Hashtable taskHash = new Hashtable();
  // For each field, create two values in the hashtable. If the field name 
  // matches a field in the Task content type, the field name will not be 
  // searchable as a key within the ExtendedProperties hashtable. So 
  // create a second field that is a duplicate of the first but having a 
  // name that doesn't exactly match an existing field in the Task 
  // content type. That way it will be a searchable ke

Access Denied error on custom workflow task list item


We have created a two level custom approval workflow on (an InfoPath) form library using SharePoint Designer (SPD) with first and second approver. The workflow works fine as long as the approver is in the Site Collection Administrators group. The approvers who are not in the admin group can get to the custom Task form for approve/reject, but they can only view the form. When they click on the “Edit Item” button of the task list item, they receive “Access Denied” error. We have given these approvers “Approve”, “Contribute” permissions on the Form library and even Full Control on the task form list (all items). Note: The users use their domain account and the error they are getting is: Access Denied, You are currently signed as DomainName\LoginName, Sign in as a different user.

We have read through several forums and have found people having the same issue. We tried all of the suggestions described in the following links - but no success so far.

SharePoint Designer Workflows, Tasks, and the Annoying “Access Denied” Error

Selecting a Task List in Sharepoint Designer 2007 while setting up "Collect Data from User"

When using Sharepoint Designer 2007 to Collect Data from User the task list cannot be selected.  Instead the Task list that is defaulted is the most recently created Task List.  How can I select a specific Task list to associate with"Collect Data from User"?

Setting the permissions for the list item in sharepoint 2010 list


Dear All,

            This is siddiqali working sharepoint 2010 as developer .My task is to enable and disable the lists by setting permissions for sharepoint lists .I have generated the list permissions successfully ,But can any one tell me how to generate the permissions for the list items.

  Example; I have the list items  such as "ID,Name,Class,Number"  when the student opens the list the filed number should not be visible for  the student .All the fields should be able to view only by admin.


I hope some one will  respond to me and solve my problem .





Mohammad Siddiqali

SSIS: return list of custom objects after a Script Task


I'm having problems returning a list of self-created .NET objects to a SSIS object variable.

In my SSIS Script Task I'm calling:

Dim fileList As List(Of FileNameEntityDate) = read.getFileNameEntityDate

Directly after this call, It is populated as the size of the List != 0:


Now, I'm trying to return that list to SSIS using variables:

Dts.Variables("oFilenameEntityDate").Value = fileList

oFilenameEntityDate is defined in SSIS as being an Object.
It is also placed in my 'Script Task' under 'ReadWriteVariables'.

When I watch that variable, it seems empty:

- User::oFilenameEntityDate
	Type	__ComObject	
	Value	System.__ComObject	

What should I do to get this working? Thanks!!

Custom permissions for a list in sharepoint 2007



I have a requirement wherein I want to give a group permission to add document but not to edit them. I have already created a custom permission group. But the issue is that my document library has custom fields.So when a user of that group uploads a single document he is redirected to EditForm.aspx and when he clicks "OK" he gets access denied error(understandably). So I created an event handler to give the user edit permission on item adding and removed the permission on item updated. But now when I add a new document, a new folder or upload multiple documents, Item Updated event is not called and thus the permissions for that group are not removed.

Any ideas how to achieve this ?

Thanks, Tejas

How to add custom list entries to mysite's calendar in Sharepoint 2007 site?


I would like to know below things

(1) How to create MySite for one specific member with other or administrator's access?

(2) Scenario : Administrator have created one SP2007 site. now Administrator have created one calendar (Sample calendar). Administrator have added some entries in calendar. now one user entered in portal site ansd view the calendar and he click on MySite menu. so this sample calendar entries should enter in that user's mysite calendar. How this can be achieved?

Thanks in advance.
Regards, Praful Udade

Setting permissions of a specific SharePoint workflow


We have a very simple workflow whereby an document placed in a public library (INBOX) is moved it to a private library (VERIFY) and then deleted. The workflow works correctly when someone who has access to the VERIFY library drops a record into the INBOX library.  However it does not work when the user does not have access to the VERIFY library.

I was told that I need to "set the AD group associated with a specific SharePoint workflow" but cannot find any reference to this in SPD.



Attach Workflow to Task List, don't get option to manually start workflow via dropdown on task item



I am running WSS 3.0 with other workflows which are functioning correctly.  I created a new workflow in Visual Studio 2008 and was able to successfully run it in my dev environment.  I attached the workflow to a task list in my dev environment and was able to manually start the workflow by using the drop down workflow option and using the menus to manually start it.  I installed this workflow in our production environment and attached it to the task list (which had a SPD workflow attached to it which stopped working about a month ago).  I made sure that the option to manually start the workflow was checked.  When I tried to manually start the workflow, (hover mouse over title, drop down) there isn’t a workflow option.  The workflow also will not start automatically when a task is changed.


I attached this same workflow to a different task list in production and get the option to start it.


I have tried creating a small workflow in SPD 2007 and attaching it to the task list.  It shows that it is attached, when I look at the workflows that are attached to the task list, but I still don’t get the option to manually start it.


I have checked my security and I have fu

Workflow Task And Relevant List Item


Hello there...

1. What is the name of  the field thats connect between the task item and  the list name or guid and the list item id or guid

2. SPD: how can when starting the workflow how can i ensure that the initial form variables will be saved at the workflow task list

Many Thanks



Picker returns nothing for BDC column in custom list


Playing with the BDC for the first time, running into some issues adding a Business Data column to a custom list.

I believe my ADF file is solid. I've been able to import that just fine and can use the application to drive various BDC-specific webparts (a Business Data List or Business Data Item, for example). It also seems to work when I manually enter information in my NewForm.aspx field and click the Check Names button (it verifies my entry and underlines it, creates link to profile when I view the list data).


If I try to use the picker, I get nothing. Enter a name I know is valid or a % and click the magnifying glass icon and I very briefly get the "Please Wait" message, then just an empty set with "Type into the search box above then press "Enter" to start your search" where my results should be.

Any pointers? Thanks.

Create a Outlook Task from Custom WebPart in Code



I have a requirement to create a Outlook Task , from a custom webpart through code .

Is this possible?

has any body tried this , if yes can you please give me an insight on how to acheive it.

Some sample Code would be highly appreciated.



SharePoint Designer: insert custom list not working anymore



Suddenly sharepoint designer decided today that it doesn't want to insert a custom list form anymore...
To be more specific, it doesn't work anymore in a site that uses the Microsoft budgeting and tracking template. In a website that uses an out of the box template, it still works.

It did work before, because I did it in other websites using the same template (it's broken there as well now).

Why oh why does SharePoint refuse to do this now?
I searched google and here on the forums, but all I could find was some issues after installing SP1, but we did that already long time ago and it was still working after that. I checked with our infrastructure guys and they didn't install new updates they say.

I also tried the solutions listed here: http://blogs.msdn.com/spdsupport/archive/2008/07/03/how-to-fix-custom-list-forms-will-not-insert-or-show-up-on-the-design-surface-of-sharepoint-designer.aspx
But they don't fix the problem.

So my problem is, I can go to Insert > SharePoint Controls > Custom List Form
I pick my list, content type and form type, I hit OK and... nothing happens.

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend