Click here to Skip to main content
15,894,343 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am programmatically delegating task to another user for a Nintex approval workflow. For example actual approver is "DOMAIN\Test1". And the delegated user is "DOMAIN\Test2"; Using the below code its delegating the task to "DOMAIN\Test2" user but the problem is still the actual approver "DOMAIN\Test1" retain the permission to complete the task, I mean "DOMAIN\Test1" still is able to click the "Complete Task" button, actually this button should be hidden for him("DOMAIN\Test1"). How can I do this?
C#
using (SPSite currentSite = new SPSite("http://tst:001/sites/Test"))
{
  using (SPWeb currentWeb = currentSite.OpenWeb())
  {

      string tasksList = "Workflow Tasks";                    
      SPUser delegateTouser = currentWeb.EnsureUser("DOMAIN\\Test2");
      SPListItem listItem = currentWeb.Lists.TryGetList(tasksList).GetItemById(101);
      listItem[SPBuiltInFieldId.AssignedTo] = delegateTouser;
      listItem[SPBuiltInFieldId.WorkflowVersion] = "1";
      listItem.Update();
  }
}
Posted
Updated 30-Nov-14 1:48am
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900