Skip to main content

Requesting a list of role can be achieved by using one of the List operations.

List

Lists all roles assigned to a project.

Syntax

C#
public PagedList<Role> List(PagingOptions pagingOptions = null)
{
}

Parameters

pageOptions

Type: PageOptions<Role>
The options for paging the results.

Return value

Remarks

The API Key user must be part of the Roles Administrators group to be able to list roles.

Example

This example shows how roles can be listed for a project.

C#
using Zengenti.Contensis.Management;

var client = ManagementClient.Create();

// Access the movie DB project
var project = client.Projects.Get("movieDb");

// List the roles with the default paging options
var roles = project.Security.Roles.List();

ListAsync

Lists all roles assigned to a project asynchronously.

Syntax

C#
public async Task<PagedList<Role>> ListAsync(PagingOptions pagingOptions = null)
{
}

Parameters

pageOptions

Type: PageOptions<Role>
The options for paging the results.

Return value

Example

This example shows how roles can be listed for a project.

C#
using Zengenti.Contensis.Management;

var client = ManagementClient.Create();

// Access the movie DB project
var project = await client.Projects.GetAsync("movieDb");

// List the roles with specific paging options
var roles = await project.Security.Roles.ListAsync(new PageOptions(pageIndex: 0, pageSize: 10));

Still need help?

If you still need help after reading this article, don't hesitate to reach out to the Contensis community on Slack or raise a support ticket to get help from our team.
New support request