CreateRole

Creates a role in the zone.

Syntax

IRole CreateRole (string name)

Parameter

Specify the following parameter when using this method:

Parameter Description
name The name of the role.

Return value

A role with the specified name.

Discussion

The role is not stored in Active Directory until you call the Commit method.

Example

The following code sample illustrates using the CreateRole method in a script:

...  
// Get the zone object
IHierarchicalZone objZone =  
cims.GetZoneByPath("cn=" + strZone + "," + strContainerDN) as IHierarchicalZone;

// create the role
if (objZone == null)  
{  
    Console.WriteLine("Zone " + strZone + " does not exist.");  
}  
else  
{  
    IRole role = objZone.CreateRole(strRole);  
    role.Description = "optional description";  
    role.Commit();  
}  
...