Skip to main content
Browse Documentation

Listing roles

Created by Scott Yearsley on 13 Dec 2019

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

List

Lists all roles assigned to a project.

Syntax

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

Parameters

pageOptions

Type: PageOptions&lt;Role&gt;
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.

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

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

Parameters

pageOptions

Type: PageOptions&lt;Role&gt;
The options for paging the results.

Return value

Example

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

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));