DelegateAllTasks
Delegate all workflow tasks from one user to another user.
Syntax
public string[] DelegateAllTasks( string currentUser, string newUser, bool sendNotification, string comments, bool global )
Parameters
- currentUser
- Type: System.String
Optional. The user from which to delegate workflow tasks.
Note: Although the parameter is optional, an error occurs if a value is not specified.
- newUser
- Type: System.String
Optional. The user to which to delegate workflow tasks.
Note: Although the parameter is optional, an error occurs if a value is not specified.
- sendNotification
- Type: System.Boolean
Required. Set to true to send a notification message to the user specified in newUser, indicating that tasks have been delegated to the user; otherwise, set to false.
- comments
- Type: System.String
Optional. Comments to include in workflow history about why tasks were delegated.
- global
- Type: System.Boolean
Required. The scope of the delegation. If set to false, only tasks in the current SharePoint site are delegated; otherwise, all tasks in the entire SharePoint farm are delegated.
Returns
Type: String[]
An array of error messages indicating any tasks that failed to be reassigned. If all tasks are successfully reassigned, an empty array is returned.
Remarks
If the Allow long term task delegations global setting is set to No, an error occurs.
The current user is determined by the credentials of the user context specified when this method is invoked (and should not be confused with the value of the currentUser parameter.)
Depending on the value of the global parameter, the current user must have appropriate permissions to invoke this method. If global is set to true, the current user must have farm administrator permissions; otherwise an error occurs. If global is set to false, 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.
Example
The following example demonstrates how to use this operation to delegate all tasks on the current site for the current user to a new user.
Request
The following SOAP request attempts to delegate all the tasks on the current site from the current user to the new user, without notifying the new user.
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:nin="http://nintex.com"> <soap:Header/> <soap:Body> <nin:DelegateAllTasks> <nin:currentUser>testdomain\testuser</nin:currentUser> <nin:newUser>testdomain\differentuser</nin:newUser> <nin:sendNotification>false</nin:sendNotification> <nin:comments>Delegating all tasks from testuser to differentuser.</nin:comments> <nin:global>false</nin:global> </nin:DelegateAllTasks> </soap:Body> </soap:Envelope>
Response
The following SOAP response indicates that all tasks for the current user have been successfully delegated to the new user.
<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> <DelegateAllTasksResponse xmlns="http://nintex.com"> <DelegateAllTasksResult/> </DelegateAllTasksResponse> </soap:Body> </soap:Envelope>