Delegates a workflow task to a user.
public bool DelegateTask( int spTaskId, string taskListName, string targetUsername, string comments, bool sendNotification )
Required. The identifier of the list item for the task. This parameter must be set to a value other than zero (0); otherwise, an error occurs.
Optional. The name or GUID of the task list that contains the task.
Optional. The user to whom the task is to be delegated.
Optional. Comments to include in workflow history about why the task was delegated.
Required. Set to true to send a notification message to the user specified in targetUsername, indicating that the task has been delegated to the user; otherwise, set to false.
false if the outcome of the task is set to any value other than Pending, and therefore can no longer be delegated; otherwise, true if the task is successfully delegated.
If the task list specified in taskListName or the task specified in spTaskId is not found, an error occurs.
The current user is determined by the credentials of the user context specified when this method is invoked. If the credentials of the current user context cannot be determined, an error occurs.
If the credentials of the current user context matches one of the approvers, assignees, or reviewers specified by the workflow action that created the task item, the method checks if the current user is allowed to delegate the task. If the current user is not allowed to delegate the task, an error occurs.
If the credentials of the current user context do not match any of the approvers, assignees, or reviewers specified by the workflow action that created the task item, an error occurs if the following requirements are not met:
The current user has site administrator permissions.
Specifically, the current user must have the following base permissions for the current SharePoint site: AddAndCustomizePages, BrowseDirectories, ManagePermissions, ManageWeb, Open, and ViewPages. For more information about SharePoint base permissions, see SPBasePermissions enumeration on Microsoft Developer Network.
The Allow site administrators to set long term delegation for other users global setting is set to Yes.
The following example demonstrates how to use this operation to delegate a workflow task to a user.
The following SOAP request attempts to delegate a workflow task in the default task list to a user, sending a notification message to that user if the delegation is successful.
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:nin="http://nintex.com"> <soap:Header/> <soap:Body> <nin:DelegateTask> <nin:spTaskId>4</nin:spTaskId> <nin:taskListName>Workflow Tasks</nin:taskListName> <nin:targetUsername>testdomain\differentuser</nin:targetUsername> <nin:comments>Test delegation</nin:comments> <nin:sendNotification>true</nin:sendNotification> </nin:DelegateTask> </soap:Body> </soap:Envelope>
The following SOAP response indicates that the task was successfully delegated.
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <soap:Body> <DelegateTaskResponse xmlns="http://nintex.com"> <DelegateTaskResult>true</DelegateTaskResult> </DelegateTaskResponse> </soap:Body> </soap:Envelope>
Delegating workflow tasks
Web Service Reference