Skip to main content
Browse Documentation

Workflow extension methods

Created by Scott Yearsley, last modified by Mike Andrews on 04 Apr 2018
using Zengenti.Contensis.Management.Workflow.Basic;

Publish

Publishes an entry instance for entries in the Contensis basic workflow.

Syntax

public static void Publish(this Workflow workflow)
{
}

Return value

Type: void

Remarks

On a successful publish, the entry instance is updated with the new version details controlled from the service. A WorkflowException will be thrown if there is any issue with the publish workflow state change. Other exception types could be thrown if there are any data validation issues, unexpected issue in the service or a local exception.

Example

// Publish the version of the entry.
entry.Workflow.Publish();

PublishAsync

Publishes an entry instance asynchronously for entries in the Contensis basic workflow.

Syntax

public async Task PublishAsync(this Workflow workflow)
{
}

Return value

Type: Task

Remarks

On a successful publish, the entry instance is updated with the new version details controlled from the service. A WorkflowException will be thrown if there is any issue with the publish workflow state change. Other exception types could be thrown if there are any data validation issues, unexpected issue in the service or a local exception.

Example

// Publish the version of the entry.
await entry.Workflow.PublishAsync();

Adding the following namespace declaration will add the Publish methods.

using Zengenti.Contensis.Management.Workflow.Approval;

Submit

Submits an entry instance to the awaiting approval state for entries in the Contensis approval workflow.

Syntax

public static void Submit(this Workflow workflow, string message = null)
{
}

Parameters

message

Type: string
An optional message that can be included with the entry submission

Return value

Type: void

Example

// Submit the entry for approval.
entry.Workflow.Submit("I've updated the 2nd paragraph to make it clearer");

SubmitAsync

Submits an entry instance to the awaiting approval state asynchronously for entries in the Contensis approval workflow.

Syntax

public static async Task SubmitAsync(this Workflow workflow, string message = null)
{
}

Parameters

message

Type: string
An optional message that can be included with the entry submission

Return value

Type: Task

Example

// Submit the entry for approval asynchronously.
await entry.Workflow.SubmitAsync("I've updated the 2nd paragraph to make it clearer");

Approve

Approves an entry for publishing for entries in the Contensis approval workflow.

Syntax

public void Approve(this Workflow workflow)
{
}

Return value

Type: void

Example

// Approve the entry for publishing.
entry.Workflow.Approve();

ApproveAsync

Approves an entry for publishing asynchronously for entries in the Contensis approval workflow.

Syntax

public async Task ApproveAsync(this Workflow workflow)
{
}

Return value

Type: Task

Example

// Approve the entry instance asynchronously.
await entry.Workflow.ApproveAsync();

Decline

Declines an entry submission for entries in the Contensis approval workflow.

Syntax

public void Decline(this Workflow workflow, string message = null)
{
}

Parameters

message

Type: string
An optional message that can be included to detail the decline reason

Return value

Type: void

Example

// Decline the entry submission
entry.Workflow.Decline("There are multiple spelling mistakes in the opening paragraph");

DeclineAsync

Declines an entry submission for entries in the Contensis approval workflow.

Syntax

public async Task DeclineAsync(this Workflow workflow, string message)
{
}

Parameters

message

Type: string
An optional message that can be included to detail the decline reason

Return value

Type: Task

Example

// Decline the entry submission asynchronously.
await entry.Workflow.DeclineAsync("I've updated the 2nd paragraph to make it clearer");

Revoke

Revokes an entry submission for entries in the Contensis approval workflow.

Syntax

public void Revoke(this Workflow workflow)
{
}

Return value

Type: void

Example

// Revoke the entry submission
entry.Workflow.Revoke();

RevokeAsync

Revokes an entry submission for entries asynchronously in the Contensis approval workflow.

Syntax

public async Task RevokeAsync(this Workflow workflow)
{
}

Return value

Type: Task

Example

// Revoke the entry submission asynchronously.
await entry.Workflow.RevokeAsync();

Adding either one of the following namespace declarations will add the Unpublish methods.

using Zengenti.Contensis.Management.Workflow.Approval;
using Zengenti.Contensis.Management.Workflow.Basic;

Unpublish

Unpublishes an entry

Syntax

public void Unpublish(this Workflow workflow, bool unpublishAll = false)
{
}

Parameters

unpublishAll

Type: boolean
An optional boolean specifying whether all language variations of the entry should be unpublished too.

Return value

Type: void

Example

// Unpublish the current entry
entry.Workflow.Unpublish();

// Unpublish all of the language variations for this entry
entry.Workflow.Unpublish(true);

UnpublishAsync

Unpublishes an entry asynchronously

Syntax

public async Task UnpublishAsync(this Workflow workflow, bool unpublishAll = false)
{
}

Parameters

unpublishAll

Type: boolean
An optional boolean specifying whether all language variations of the entry should be unpublished too.

Return value

Type: Task

Example

// Unpublish the current entry
await entry.Workflow.UnpublishAsync();

// Unpublish all of the language variations for this entry
await entry.Workflow.UnpublishAsync(true);