GetGroupByPath

Returns an Active Directory group object with all of its related IBM Security-specific data given the path to the object.

Syntax

IGroup GetGroupByPath(string path)

Parameter

Specify the following parameter when using this method:

Parameter Description
path The LDAP path or distinguished name of the group object you want to retrieve.

Return value

The group object as:

Centrify.DirectControl.API.IGroup

Discussion

This method returns the group object using the LDAP path or distinguished name of the object. The LDAP path to a group uses the following format:

LDAP://[domain/]attr=name,[...],dc=domain_part,[...]

For example, if you use the default parent location for groups in the domain arcade.com, the LDAP path for the IT Interns group is:

LDAP://cn=IT Interns,cn=Users,dc=arcade,dc=com

The method returns the group object as Centrify.DirectControl.API.Group.ObjectName.

Exceptions

GetGroupByPath throws an ArgumentException if the group path is null or empty.

Example

The following code sample illustrates using this method in a script:

...
string strParent = "CN=zones,CN=Centrify,CN=Program Data";
if (args.Length != 2)
{
    Console.WriteLine("Usage:");
    Console.WriteLine(" test_remove_group.exe
    \"cn=sample_group,ou=groups,dc=domain,dc=tld\\" \\"default\\"");
    return;
}
string strGroup = args[0];
string strZone = args[1];
// Need to obtain an active directory container object
DirectoryEntry objRootDSE = new DirectoryEntry("LDAP://rootDSE");
DirectoryEntry objContainer = new DirectoryEntry("LDAP://" + strParent + "," +
    objRootDSE.Properties["defaultNamingContext"].Value.ToString());
string strContainerDN = objContainer.Properties["DistinguishedName"].Value as string;
// Create a CIMS object to interact with AD
ICims cims = new Cims();
// Note the lack of the cims.connect function.
// By default, this application will use the connection to the domain controller
// and existing credentials from the computer already logged in.
// Get the group object
IGroup objGroup = cims.GetGroupByPath(strGroup);
// Get the zone object
IZone objZone = cims.GetZoneByPath("cn=" + strZone + "," + strContainerDN);
...