Exago .NET API Documentation
NewRole Method
Example 
WebReports.Api.Roles Namespace > RoleCollection Class : NewRole Method
Optional ID for the new Role object.

Create and return a new Role object with the ID id, add it to the Role collection and then mark it as the active role without applying its General settings changes to the system.

If id is not provided, a GUID will be used for the role's ID.

Syntax
public Role NewRole( 
   System.string id
)

Parameters

id
Optional ID for the new Role object.

Return Value

A new Role object that is set to be the currently active role.
Exceptions
ExceptionDescription
A WrNonUniqueIdException will be thrown if attempting to create a new Role with an ID that already exists in the RoleCollection.
Example
Create a Role with a generic GUID for its ID and then activate it for the session.
Role mySessionRole = api.Roles.NewRole();
//make changes to the Role's properties here
mySessionRole.Activate(true);
See Also

Reference

RoleCollection Class
RoleCollection Members