AddLongTermDelegationRule

Add a long-term delegation rule.

Syntax

public int AddLongTermDelegationRule(
	DateTime fromTheBeginningOf,
	DateTime untilTheEndOf,
	string delegateFrom,
	string delegateTo,
	bool currentSiteOnly
)

Parameters

fromTheBeginningOf
Type: System.DateTime

Required. The date at which the delegation rule begins, in ISO 8601 format.

If a time is specified as part of the value, the time portion of the value is ignored. The delegation rule starts on 12:01 AM, in the time zone for the locale of the current SharePoint site. This value must be equal to or earlier than the value specified in untilTheEndOf; otherwise an error occurs.

untilTheEndOf
Type: System.DateTime

Required. The date at which the delegation rule ends, in ISO 8601 format.

If a time is specified as part of the value, the time portion of the value is ignored. The delegation rule ends on 12:00 AM, in the time zone of the locale for the current SharePoint site. This value must be equal to or later than the value specified in fromTheBeginningOf; otherwise, an error occurs.

delegateFrom
Type: System.String

Optional. The user from which the delegation rule delegates workflow tasks. If a value is not specified, the current user is used.

delegateTo
Type: System.String

Optional. The user to which the delegation rule delegates workflow tasks.

Note: Although the parameter is optional, an error occurs if a value is not specified.

currentSiteOnly
Type: System.Boolean

Required. The scope of the delegation rule. If set to true, the delegation rule applies only to the current SharePoint site; otherwise, the delegation rule applies to the entire SharePoint farm.

Returns

Type: Int32

The identifier of the delegation rule.

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. If the credentials of the current user context cannot be determined, an error occurs. If the current user is not the user specified in delegateFrom, an error occurs if the following requirements are not met:

The identifier returned by this method can be used as the value of the id parameter for the DeleteLongTermDelegationRule method.

Example

The following example demonstrates how to use this operation to add a delegation rule.

Request

The following SOAP request attempts to define a delegation rule that, from 12:01 AM on February 2, 2015 to 12:00 AM on February 6, 2015, all tasks on the current SharePoint site for the user named testdomain\testuser are delegated to the user named testdomain\differentuser.

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:nin="http://nintex.com">
   <soap:Header/>
   <soap:Body>
      <nin:AddLongTermDelegationRule>
         <nin:fromTheBeginningOf>2015-02-02</nin:fromTheBeginningOf>
         <nin:untilTheEndOf>2015-02-06</nin:untilTheEndOf>
         <nin:delegateFrom>testdomain\testuser</nin:delegateFrom>
         <nin:delegateTo>testdomain\differentuser</nin:delegateTo>
         <nin:currentSiteOnly>true</nin:currentSiteOnly>
      </nin:AddLongTermDelegationRule>
   </soap:Body>
</soap:Envelope>

Response

The following SOAP response indicates that the delegation rule was successfully added, with an identifier of 1.

<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>
      <AddLongTermDelegationRuleResponse xmlns="http://nintex.com">
         <AddLongTermDelegationRuleResult>1</AddLongTermDelegationRuleResult>
      </AddLongTermDelegationRuleResponse>
   </soap:Body>
</soap:Envelope>

See Also

Operations

Delegating workflow tasks

Reference

DelegateAllTasks

DelegateTask

DeleteLongTermDelegationRule

Web Service Reference