Class ApprovalEngineExtensions

Extension method class for IApprovalEngine

Inheritance
System.Object
ApprovalEngineExtensions
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: EPiServer.Approvals
Assembly: EPiServer.dll
Version: 10.10.4
Syntax
public static class ApprovalEngineExtensions

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
IApprovalEngine engine

The approval engine that is extended

System.Int32 id

The identifier of an approval instance

System.String username

Name of the user

Returns
Type Description
System.Threading.Tasks.Task

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
IApprovalEngine engine

The approval engine that is extended

System.Int32 id

The identifier of the approval instance

System.String username

Name of the user

System.Int32 stepIndex

Index of the step to approve. If scope is Force, then this parameter is disregarded

ApprovalDecisionScope scope

Scope of the approve

Returns
Type Description
System.Threading.Tasks.Task
Exceptions
Type Condition
MissingApprovalException

There was a problem finding an approval

MissingApprovalDefinitionException

There was a problem finding an approval definition

ApprovalStepIndexException

Step index is currently invalid

ApprovalReviewerStepException

User is not part of the approval definition step

ApprovalMissingCommentException

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
IApprovalEngine engine

The approval engine that is extended

System.Int32 id

The identifier of the approval instance

System.String username

Name of the user

System.Int32 stepIndex

Index of the step to approve

Returns
Type Description
System.Threading.Tasks.Task
Exceptions
Type Condition
MissingApprovalException

There was a problem finding an approval

MissingApprovalDefinitionException

There was a problem finding an approval definition

ApprovalStepIndexException

Step index is currently invalid

ApprovalReviewerStepException

User is not part of the approval definition step

ApprovalMissingCommentException

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
IApprovalEngine engine

The approval engine that is extended

System.Int32 id

The identifier of the approval instance

System.String username

Name of the user

System.Int32 stepIndex

Index of the step to approve

System.String comment

An optional comment

Returns
Type Description
System.Threading.Tasks.Task
Exceptions
Type Condition
MissingApprovalException

There was a problem finding an approval

MissingApprovalDefinitionException

There was a problem finding an approval definition

ApprovalStepIndexException

Step index is currently invalid

ApprovalReviewerStepException

User is not part of the approval definition step

ApprovalMissingCommentException

The approval definition requires a comment when approving

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
IApprovalEngine engine

The approval engine that is extended

System.Collections.Generic.IEnumerable<System.Int32> ids

The identifiers of the approval instances

System.String username

Name of the user

Returns
Type Description
System.Threading.Tasks.Task
Exceptions
Type Condition
MissingApprovalException

There was a problem finding an approval

MissingApprovalDefinitionException

There was a problem finding an approval definition

ApprovalMissingCommentException

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
IApprovalEngine engine

The approval engine that is extended

System.Collections.Generic.IEnumerable<System.Int32> ids

The identifiers of the approval instances

System.String username

Name of the user

System.String comment

An optional comment

Returns
Type Description
System.Threading.Tasks.Task
Exceptions
Type Condition
MissingApprovalException

There was a problem finding an approval

MissingApprovalDefinitionException

There was a problem finding an approval definition

ApprovalMissingCommentException

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
IApprovalEngine engine

The approval engine that is extended

System.Int32 id

The identifier of the approval instance

System.String username

Name of the user

Returns
Type Description
System.Threading.Tasks.Task
Exceptions
Type Condition
MissingApprovalException

There was a problem finding an approval

MissingApprovalDefinitionException

There was a problem finding an approval definition

ApprovalMissingCommentException

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
IApprovalEngine engine

The approval engine that is extended

System.Int32 id

The identifier of the approval instance

System.String username

Name of the user

System.String comment

An optional comment

Returns
Type Description
System.Threading.Tasks.Task
Exceptions
Type Condition
MissingApprovalException

There was a problem finding an approval

MissingApprovalDefinitionException

There was a problem finding an approval definition

ApprovalMissingCommentException

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
IApprovalEngine engine

The approval engine that is extended

System.Int32 id

The identifier of the approval instance

System.String username

Name of the user

System.Int32 stepIndex

Index of the step to approve

Returns
Type Description
System.Threading.Tasks.Task
Exceptions
Type Condition
MissingApprovalException

There was a problem finding an approval

MissingApprovalDefinitionException

There was a problem finding an approval definition

ApprovalMissingCommentException

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
IApprovalEngine engine

The approval engine that is extended

System.Int32 id

The identifier of the approval instance

System.String username

Name of the user

System.Int32 stepIndex

Index of the step to approve

System.String comment

An optional comment

Returns
Type Description
System.Threading.Tasks.Task
Exceptions
Type Condition
MissingApprovalException

There was a problem finding an approval

MissingApprovalDefinitionException

There was a problem finding an approval definition

ApprovalMissingCommentException

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
IApprovalEngine engine

The approval engine that is extended

System.Collections.Generic.IEnumerable<System.Int32> ids

The identifiers of the approval instances

System.String username

Name of the user

Returns
Type Description
System.Threading.Tasks.Task
Exceptions
Type Condition
MissingApprovalException

There was a problem finding an approval

MissingApprovalDefinitionException

There was a problem finding an approval definition

ApprovalRejectionException

Rejection is not allowed on an approved approval

ApprovalMissingCommentException

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
IApprovalEngine engine

The approval engine that is extended

System.Collections.Generic.IEnumerable<System.Int32> ids

The identifiers of the approval instances

System.String username

Name of the user

System.String comment

An optional comment

Returns
Type Description
System.Threading.Tasks.Task
Exceptions
Type Condition
MissingApprovalException

There was a problem finding an approval

MissingApprovalDefinitionException

There was a problem finding an approval definition

ApprovalRejectionException

Rejection is not allowed on an approved approval

ApprovalMissingCommentException

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
IApprovalEngine engine

The approval engine that is extended

System.Int32 id

The identifier of the approval instance

System.String username

Name of the user

Returns
Type Description
System.Threading.Tasks.Task
Exceptions
Type Condition
MissingApprovalException

There was a problem finding an approval

MissingApprovalDefinitionException

There was a problem finding an approval definition

ApprovalRejectionException

Rejection is not allowed on an approved approval

ApprovalMissingCommentException

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
IApprovalEngine engine

The approval engine that is extended

System.Int32 id

The identifier of the approval instance

System.String username

Name of the user

System.String comment

An optional comment

Returns
Type Description
System.Threading.Tasks.Task
Exceptions
Type Condition
MissingApprovalException

There was a problem finding an approval

MissingApprovalDefinitionException

There was a problem finding an approval definition

ApprovalRejectionException

Rejection is not allowed on an approved approval

ApprovalMissingCommentException

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
IApprovalEngine engine

The approval engine that is extended

System.Int32 id

The identifier of the approval instance

System.String username

Name of the user

System.Int32 stepIndex

Index of the step to reject

Returns
Type Description
System.Threading.Tasks.Task
Exceptions
Type Condition
MissingApprovalException

There was a problem finding an approval

MissingApprovalDefinitionException

There was a problem finding an approval definition

ApprovalRejectionException

Rejection is not allowed on an approved approval

ApprovalMissingCommentException

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
IApprovalEngine engine

The approval engine that is extended

System.Int32 id

The identifier of the approval instance

System.String username

Name of the user

System.Int32 stepIndex

Index of the step to reject

System.String comment

An optional comment

Returns
Type Description
System.Threading.Tasks.Task
Exceptions
Type Condition
MissingApprovalException

There was a problem finding an approval

MissingApprovalDefinitionException

There was a problem finding an approval definition

ApprovalRejectionException

Rejection is not allowed on an approved approval

ApprovalMissingCommentException

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
IApprovalEngine engine

The approval engine that is extended

System.Int32 id

The identifier of the approval instance

System.String username

Name of the user

System.Int32 stepIndex

Index of the step to reject. If scope is Force, then this parameter is disregarded

ApprovalDecisionScope scope

Scope of the reject

Returns
Type Description
System.Threading.Tasks.Task
Exceptions
Type Condition
MissingApprovalException

There was a problem finding an approval

MissingApprovalDefinitionException

There was a problem finding an approval definition

ApprovalRejectionException

Rejection is not allowed on an approved approval

ApprovalStepIndexException

Step index is currently invalid

ApprovalReviewerStepException

User is not part of the approval definition step

ApprovalMissingCommentException

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
IApprovalEngine engine

The approval engine that is extended

System.Int32 id

The identifier of the approval instance

System.String username

Name of the user

System.Int32 stepIndex

Index of the step to reject

Returns
Type Description
System.Threading.Tasks.Task
Exceptions
Type Condition
MissingApprovalException

There was a problem finding an approval

MissingApprovalDefinitionException

There was a problem finding an approval definition

ApprovalRejectionException

Rejection is not allowed on an approved approval

ApprovalStepIndexException

Step index is currently invalid

ApprovalReviewerStepException

User is not part of the approval definition step

ApprovalMissingCommentException

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
IApprovalEngine engine

The approval engine that is extended

System.Int32 id

The identifier of the approval instance

System.String username

Name of the user

System.Int32 stepIndex

Index of the step to reject

System.String comment

An optional comment

Returns
Type Description
System.Threading.Tasks.Task
Exceptions
Type Condition
MissingApprovalException

There was a problem finding an approval

MissingApprovalDefinitionException

There was a problem finding an approval definition

ApprovalRejectionException

Rejection is not allowed on an approved approval

ApprovalStepIndexException

Step index is currently invalid

ApprovalReviewerStepException

User is not part of the approval definition step

ApprovalMissingCommentException

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
IApprovalEngine engine

The approval engine that is being extended

System.Uri reference

Approval reference

System.String username

Name of the user

System.Boolean throwOnMissingDefinition

Specifies if an exception should be thrown when an definition is missing or is not enabled

Returns
Type Description
System.Threading.Tasks.Task<Approval>

The approval instance

Exceptions
Type Condition
MissingApprovalException

There was a problem finding an approval

DisabledApprovalDefinitionException

An approval definition was disabled

ApprovalInReviewException

The operation cannot be executed due to a conflict with an approval in review