Class ApprovalEngineExtensions
Extension method class for IApproval
Inheritance
Namespace: EPiServer.Approvals
Assembly: EPiServer.dll
Version: 12.0.3Syntax
public static class ApprovalEngineExtensions : Object
Methods
AbortAsync(IApprovalEngine, Int32, String)
Aborts an approval instance.
Declaration
public static Task AbortAsync(this IApprovalEngine engine, int id, string username)
Parameters
Type | Name | Description |
---|---|---|
IApproval |
engine | The approval engine that is extended |
System. |
id | The identifier of an approval instance |
System. |
username | Name of the user |
Returns
Type | Description |
---|---|
System. |
ApproveAsync(IApprovalEngine, Int32, String, Int32, ApprovalDecisionScope)
Approves a step in an approval instance.
Declaration
public static Task ApproveAsync(this IApprovalEngine engine, int id, string username, int stepIndex, ApprovalDecisionScope scope)
Parameters
Type | Name | Description |
---|---|---|
IApproval |
engine | The approval engine that is extended |
System. |
id | The identifier of the approval instance |
System. |
username | Name of the user |
System. |
stepIndex | Index of the step to approve. If scope is Force, then this parameter is disregarded |
Approval |
scope | Scope of the approve |
Returns
Type | Description |
---|---|
System. |
Exceptions
Type | Condition |
---|---|
Missing |
There was a problem finding an approval |
Missing |
There was a problem finding an approval definition |
Approval |
Step index is currently invalid |
Approval |
User is not part of the approval definition step |
Approval |
The approval definition requires a comment when approving |
ApproveStepAsync(IApprovalEngine, Int32, String, Int32)
Approves a step in an approval instance.
Declaration
public static Task ApproveStepAsync(this IApprovalEngine engine, int id, string username, int stepIndex)
Parameters
Type | Name | Description |
---|---|---|
IApproval |
engine | The approval engine that is extended |
System. |
id | The identifier of the approval instance |
System. |
username | Name of the user |
System. |
stepIndex | Index of the step to approve |
Returns
Type | Description |
---|---|
System. |
Exceptions
Type | Condition |
---|---|
Missing |
There was a problem finding an approval |
Missing |
There was a problem finding an approval definition |
Approval |
Step index is currently invalid |
Approval |
User is not part of the approval definition step |
Approval |
The approval definition requires a comment when approving |
ApproveStepAsync(IApprovalEngine, Int32, String, Int32, String)
Approves a step in an approval instance.
Declaration
public static Task ApproveStepAsync(this IApprovalEngine engine, int id, string username, int stepIndex, string comment)
Parameters
Type | Name | Description |
---|---|---|
IApproval |
engine | The approval engine that is extended |
System. |
id | The identifier of the approval instance |
System. |
username | Name of the user |
System. |
stepIndex | Index of the step to approve |
System. |
comment | An optional comment |
Returns
Type | Description |
---|---|
System. |
Exceptions
Type | Condition |
---|---|
Missing |
There was a problem finding an approval |
Missing |
There was a problem finding an approval definition |
Approval |
Step index is currently invalid |
Approval |
User is not part of the approval definition step |
Approval |
The approval definition requires a comment when approving |
CommentAsync(IApprovalEngine, Int32, String, Int32, String)
Adds a comment to a step in an approval instance
Declaration
public static Task CommentAsync(this IApprovalEngine engine, int id, string username, int stepIndex, string comment)
Parameters
Type | Name | Description |
---|---|---|
IApproval |
engine | The approval engine that is extended |
System. |
id | The identifier of the approval instance |
System. |
username | Name of the user |
System. |
stepIndex | Index of the step to comment |
System. |
comment | An optional comment |
Returns
Type | Description |
---|---|
System. |
Exceptions
Type | Condition |
---|---|
Missing |
There was a problem finding an approval |
Approval |
A comment is required when commenting |
ForceApproveAsync(IApprovalEngine, IEnumerable<Int32>, String)
Force approves a list of approval instances.
Declaration
public static Task ForceApproveAsync(this IApprovalEngine engine, IEnumerable<int> ids, string username)
Parameters
Type | Name | Description |
---|---|---|
IApproval |
engine | The approval engine that is extended |
System. |
ids | The identifiers of the approval instances |
System. |
username | Name of the user |
Returns
Type | Description |
---|---|
System. |
Exceptions
Type | Condition |
---|---|
Missing |
There was a problem finding an approval |
Missing |
There was a problem finding an approval definition |
Approval |
The approval definition requires a comment when approving |
ForceApproveAsync(IApprovalEngine, IEnumerable<Int32>, String, String)
Force approves a list of approval instances.
Declaration
public static Task ForceApproveAsync(this IApprovalEngine engine, IEnumerable<int> ids, string username, string comment)
Parameters
Type | Name | Description |
---|---|---|
IApproval |
engine | The approval engine that is extended |
System. |
ids | The identifiers of the approval instances |
System. |
username | Name of the user |
System. |
comment | An optional comment |
Returns
Type | Description |
---|---|
System. |
Exceptions
Type | Condition |
---|---|
Missing |
There was a problem finding an approval |
Missing |
There was a problem finding an approval definition |
Approval |
The approval definition requires a comment when approving |
ForceApproveAsync(IApprovalEngine, Int32, String)
Force approves an approval instance.
Declaration
public static Task ForceApproveAsync(this IApprovalEngine engine, int id, string username)
Parameters
Type | Name | Description |
---|---|---|
IApproval |
engine | The approval engine that is extended |
System. |
id | The identifier of the approval instance |
System. |
username | Name of the user |
Returns
Type | Description |
---|---|
System. |
Exceptions
Type | Condition |
---|---|
Missing |
There was a problem finding an approval |
Missing |
There was a problem finding an approval definition |
Approval |
The approval definition requires a comment when approving |
ForceApproveAsync(IApprovalEngine, Int32, String, String)
Force approves an approval instance.
Declaration
public static Task ForceApproveAsync(this IApprovalEngine engine, int id, string username, string comment)
Parameters
Type | Name | Description |
---|---|---|
IApproval |
engine | The approval engine that is extended |
System. |
id | The identifier of the approval instance |
System. |
username | Name of the user |
System. |
comment | An optional comment |
Returns
Type | Description |
---|---|
System. |
Exceptions
Type | Condition |
---|---|
Missing |
There was a problem finding an approval |
Missing |
There was a problem finding an approval definition |
Approval |
The approval definition requires a comment when approving |
ForceApproveStepAsync(IApprovalEngine, Int32, String, Int32)
Force approves a step in an approval instance.
Declaration
public static Task ForceApproveStepAsync(this IApprovalEngine engine, int id, string username, int stepIndex)
Parameters
Type | Name | Description |
---|---|---|
IApproval |
engine | The approval engine that is extended |
System. |
id | The identifier of the approval instance |
System. |
username | Name of the user |
System. |
stepIndex | Index of the step to approve |
Returns
Type | Description |
---|---|
System. |
Exceptions
Type | Condition |
---|---|
Missing |
There was a problem finding an approval |
Missing |
There was a problem finding an approval definition |
Approval |
The approval definition requires a comment when approving |
ForceApproveStepAsync(IApprovalEngine, Int32, String, Int32, String)
Force approves a step in an approval instance.
Declaration
public static Task ForceApproveStepAsync(this IApprovalEngine engine, int id, string username, int stepIndex, string comment)
Parameters
Type | Name | Description |
---|---|---|
IApproval |
engine | The approval engine that is extended |
System. |
id | The identifier of the approval instance |
System. |
username | Name of the user |
System. |
stepIndex | Index of the step to approve |
System. |
comment | An optional comment |
Returns
Type | Description |
---|---|
System. |
Exceptions
Type | Condition |
---|---|
Missing |
There was a problem finding an approval |
Missing |
There was a problem finding an approval definition |
Approval |
The approval definition requires a comment when approving |
ForceRejectAsync(IApprovalEngine, IEnumerable<Int32>, String)
Force rejects a list of approval instances.
Declaration
public static Task ForceRejectAsync(this IApprovalEngine engine, IEnumerable<int> ids, string username)
Parameters
Type | Name | Description |
---|---|---|
IApproval |
engine | The approval engine that is extended |
System. |
ids | The identifiers of the approval instances |
System. |
username | Name of the user |
Returns
Type | Description |
---|---|
System. |
Exceptions
Type | Condition |
---|---|
Missing |
There was a problem finding an approval |
Missing |
There was a problem finding an approval definition |
Approval |
Rejection is not allowed on an approved approval |
Approval |
The approval definition requires a comment when rejecting |
ForceRejectAsync(IApprovalEngine, IEnumerable<Int32>, String, String)
Force rejects a list of approval instances.
Declaration
public static Task ForceRejectAsync(this IApprovalEngine engine, IEnumerable<int> ids, string username, string comment)
Parameters
Type | Name | Description |
---|---|---|
IApproval |
engine | The approval engine that is extended |
System. |
ids | The identifiers of the approval instances |
System. |
username | Name of the user |
System. |
comment | An optional comment |
Returns
Type | Description |
---|---|
System. |
Exceptions
Type | Condition |
---|---|
Missing |
There was a problem finding an approval |
Missing |
There was a problem finding an approval definition |
Approval |
Rejection is not allowed on an approved approval |
Approval |
The approval definition requires a comment when rejecting |
ForceRejectAsync(IApprovalEngine, Int32, String)
Force rejects an approval instance.
Declaration
public static Task ForceRejectAsync(this IApprovalEngine engine, int id, string username)
Parameters
Type | Name | Description |
---|---|---|
IApproval |
engine | The approval engine that is extended |
System. |
id | The identifier of the approval instance |
System. |
username | Name of the user |
Returns
Type | Description |
---|---|
System. |
Exceptions
Type | Condition |
---|---|
Missing |
There was a problem finding an approval |
Missing |
There was a problem finding an approval definition |
Approval |
Rejection is not allowed on an approved approval |
Approval |
The approval definition requires a comment when rejecting |
ForceRejectAsync(IApprovalEngine, Int32, String, String)
Force rejects an approval instance.
Declaration
public static Task ForceRejectAsync(this IApprovalEngine engine, int id, string username, string comment)
Parameters
Type | Name | Description |
---|---|---|
IApproval |
engine | The approval engine that is extended |
System. |
id | The identifier of the approval instance |
System. |
username | Name of the user |
System. |
comment | An optional comment |
Returns
Type | Description |
---|---|
System. |
Exceptions
Type | Condition |
---|---|
Missing |
There was a problem finding an approval |
Missing |
There was a problem finding an approval definition |
Approval |
Rejection is not allowed on an approved approval |
Approval |
The approval definition requires a comment when rejecting |
ForceRejectStepAsync(IApprovalEngine, Int32, String, Int32)
Force rejects a step in an approval instance.
Declaration
public static Task ForceRejectStepAsync(this IApprovalEngine engine, int id, string username, int stepIndex)
Parameters
Type | Name | Description |
---|---|---|
IApproval |
engine | The approval engine that is extended |
System. |
id | The identifier of the approval instance |
System. |
username | Name of the user |
System. |
stepIndex | Index of the step to reject |
Returns
Type | Description |
---|---|
System. |
Exceptions
Type | Condition |
---|---|
Missing |
There was a problem finding an approval |
Missing |
There was a problem finding an approval definition |
Approval |
Rejection is not allowed on an approved approval |
Approval |
The approval definition requires a comment when rejecting |
ForceRejectStepAsync(IApprovalEngine, Int32, String, Int32, String)
Force rejects a step in an approval instance.
Declaration
public static Task ForceRejectStepAsync(this IApprovalEngine engine, int id, string username, int stepIndex, string comment)
Parameters
Type | Name | Description |
---|---|---|
IApproval |
engine | The approval engine that is extended |
System. |
id | The identifier of the approval instance |
System. |
username | Name of the user |
System. |
stepIndex | Index of the step to reject |
System. |
comment | An optional comment |
Returns
Type | Description |
---|---|
System. |
Exceptions
Type | Condition |
---|---|
Missing |
There was a problem finding an approval |
Missing |
There was a problem finding an approval definition |
Approval |
Rejection is not allowed on an approved approval |
Approval |
The approval definition requires a comment when rejecting |
RejectAsync(IApprovalEngine, Int32, String, Int32, ApprovalDecisionScope)
Rejects a step in an approval instance.
Declaration
public static Task RejectAsync(this IApprovalEngine engine, int id, string username, int stepIndex, ApprovalDecisionScope scope)
Parameters
Type | Name | Description |
---|---|---|
IApproval |
engine | The approval engine that is extended |
System. |
id | The identifier of the approval instance |
System. |
username | Name of the user |
System. |
stepIndex | Index of the step to reject. If scope is Force, then this parameter is disregarded |
Approval |
scope | Scope of the reject |
Returns
Type | Description |
---|---|
System. |
Exceptions
Type | Condition |
---|---|
Missing |
There was a problem finding an approval |
Missing |
There was a problem finding an approval definition |
Approval |
Rejection is not allowed on an approved approval |
Approval |
Step index is currently invalid |
Approval |
User is not part of the approval definition step |
Approval |
The approval definition requires a comment when rejecting |
RejectStepAsync(IApprovalEngine, Int32, String, Int32)
Rejects a step in an approval instance.
Declaration
public static Task RejectStepAsync(this IApprovalEngine engine, int id, string username, int stepIndex)
Parameters
Type | Name | Description |
---|---|---|
IApproval |
engine | The approval engine that is extended |
System. |
id | The identifier of the approval instance |
System. |
username | Name of the user |
System. |
stepIndex | Index of the step to reject |
Returns
Type | Description |
---|---|
System. |
Exceptions
Type | Condition |
---|---|
Missing |
There was a problem finding an approval |
Missing |
There was a problem finding an approval definition |
Approval |
Rejection is not allowed on an approved approval |
Approval |
Step index is currently invalid |
Approval |
User is not part of the approval definition step |
Approval |
The approval definition requires a comment when rejecting |
RejectStepAsync(IApprovalEngine, Int32, String, Int32, String)
Rejects a step in an approval instance.
Declaration
public static Task RejectStepAsync(this IApprovalEngine engine, int id, string username, int stepIndex, string comment)
Parameters
Type | Name | Description |
---|---|---|
IApproval |
engine | The approval engine that is extended |
System. |
id | The identifier of the approval instance |
System. |
username | Name of the user |
System. |
stepIndex | Index of the step to reject |
System. |
comment | An optional comment |
Returns
Type | Description |
---|---|
System. |
Exceptions
Type | Condition |
---|---|
Missing |
There was a problem finding an approval |
Missing |
There was a problem finding an approval definition |
Approval |
Rejection is not allowed on an approved approval |
Approval |
Step index is currently invalid |
Approval |
User is not part of the approval definition step |
Approval |
The approval definition requires a comment when rejecting |
StartAsync(IApprovalEngine, Uri, String, Boolean)
Start an approval instance for an approval reference.
Declaration
public static Task<Approval> StartAsync(this IApprovalEngine engine, Uri reference, string username, bool throwOnMissingDefinition)
Parameters
Type | Name | Description |
---|---|---|
IApproval |
engine | The approval engine that is being extended |
System. |
reference | Approval reference |
System. |
username | Name of the user |
System. |
throwOnMissingDefinition | Specifies if an exception should be thrown when an definition is missing or is not enabled |
Returns
Type | Description |
---|---|
System. |
The approval instance |
Exceptions
Type | Condition |
---|---|
Missing |
There was a problem finding an approval |
Disabled |
An approval definition was disabled |
Approval |
The operation cannot be executed due to a conflict with an approval in review |