Creating a task with special permissions  
Author Message
Alexander Shiryaev





PostPosted: SharePoint - Workflow, Creating a task with special permissions Top

Does anybody have suggestions on how to update custom workflow task item
permissions The SpecialPermissions property available while creating a
task. It's an HybridDictionary but there's no documentation available
on the topic. Anyone ever used this


SharePoint Products and Technologies1  
 
 
Mikaelo





PostPosted: SharePoint - Workflow, Creating a task with special permissions Top

Hi

When you create task use (CreateTask Method, or OnReplicatorChildDataInitialize)

point SpecialPermissions property to

public System.Collections.Specialized.HybridDictionary createTask_SpecialPermissions

and when create task use

createTask_SpecialPermissions = new System.Collections.Specialized.HybridDictionary();

createTask_SpecialPermissions[taskOwner.LoginName] = SPRoleType.Contributor; // repeat this step for all users

createTask_SpecialPermissions[user1.LoginName] = SPRoleType.Reader; ....

Mike


 
 
Uwe82





PostPosted: SharePoint - Workflow, Creating a task with special permissions Top

I tried this solution, it gets compiled, but I still can change the task with another user.

Note: I have a custom InfoPath-Form assigned to this TaskType, maybe that could be a problem.

 

//EDIT: Ok, it works, when I have a public variable and assigned this to SpecialPermissions in the designer, but not, if I create the SpecialPermissions-Object in the CreateTask-method and assign it to the property. Maybe the designer sets a specific variable...


 
 
dave.paul





PostPosted: SharePoint - Workflow, Creating a task with special permissions Top

Yes can't get it to work either from VS2005 assembly; have tried the code above here and also what's in the Setting custom task list permissions post. So not sure what's going on A bug in WSS3/MOSS
 
 
Uwe82





PostPosted: SharePoint - Workflow, Creating a task with special permissions Top

Did you read my Edit

You have to define a public variable HybridDictionary(); and assign this in the workflow-designer in the SpecialPermissions-property of the CreateTask-Activity (blue exclamation mark). In the CreateTask-method, where you create a GUID an set the stuff, use the following code for example:

task1Permissions = new System.Collections.Specialized.HybridDictionary();
task1Permissions[taskVertreter.AssignedTo] =
SPRoleType.Contributor;
task1Permissions[applicant] =
SPRoleType.Reader;

It should work this way.


 
 
dave.paul





PostPosted: SharePoint - Workflow, Creating a task with special permissions Top

Yes thanks alot! it assigns permissions to the user for the task no bother; however the task involves the reviewer, reviewing the content of a page and assigning permissions to the listitem (page), which doesn't work unfortunately, but that's slightly different to the task permissions mentioned here. I'd love to know how/why assigning permissions to list items in workflows isn't working using the code mentioned in the list item permissions post 'Setting custom task list permissions' by Johhny H

Cheers anyway!


 
 
ylopez





PostPosted: SharePoint - Workflow, Creating a task with special permissions Top

Hi I have use this code and it works very good but i have a question.

How can I Update the SpecialPermissions Property In the UpdateTask Event.

I assing SpecialPermissions to the task when i create it same as your example:

createTask_SpecialPermissions = new System.Collections.Specialized.HybridDictionary();

createTask_SpecialPermissions[taskOwner.LoginName] = SPRoleType.Contributor; // repeat this step for all users

createTask_SpecialPermissions[user1.LoginName] = SPRoleType.Reader; ....

How can I UPDATE the SpecialPermissions of the same TASK in the UPDATE EVENT

private void TASK1_Update(object sender, EventArgs e)

{

UpdateProp.AssignedTo = "MOSSRV\\user1";

UpdateProp.SpecialPermissions //doesn't Exist.

}

Do you have any Ideas. Thanks.

It very Important.!!!!!



 
 
Uwe82





PostPosted: SharePoint - Workflow, Creating a task with special permissions Top

You are right, there is no such property. And I really don't know how you can do this.

Maybe in this case you have to use the RoleAssignment stuff. Just search for this, I didn't use it yet and can't help you there :(


 
 
Mikaelo





PostPosted: SharePoint - Workflow, Creating a task with special permissions Top

Uwe82 is right

Task List is a list, so you can set role assignments to list item. But you must give workflow user rights to manage task list permissions.


 
 
ylopez





PostPosted: SharePoint - Workflow, Creating a task with special permissions Top

Thanks

But my case is not too easy, I first assing a TASK to an Specific Rol and Later I make an Update to the Task.

When I try to Update Task Item The Workflow Locks The Item And Permanently Blocks the task Item For users to manage it.

Does some one have done it successfully.

I Think Is the same Issue: http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=1309155&SiteID=1



 
 
dcfdfcdsvcfe3ee





PostPosted: SharePoint - Workflow, Creating a task with special permissions Top

Hi

The answer is here

http://blogit.create.pt/blogs/tiagooliveira/archive/2007/12/26/Set-Sharepoint-workflow-task-permissions.aspx