Commit

Commits any changes or updates to the group object and saves the changes to Active Directory.

Syntax

void Commit()

Discussion

When you use this method, it checks and validates the data before saving it in Active Directory. Before saving, the method validates the following:

  • The group name is a valid string that contains only letters (upper- or lowercase), numerals 0 through 9, and the hyphen (-) and underscore (_) characters.

  • The GID value is a positive integer. Negative numbers are not allowed.

  • The group name does not duplicate an existing group name.

Exceptions

Commit may throw one of the following exceptions:

  • ApplicationException if any field in the UNIX group profile is invalid.

  • COMException if an LDAP error occurs. LDAP errors can occur if the connection to the LDAP server fails, the connection times out, invalidcredentials are presented, or there are other problems communicating with Active Directory.

  • UnauthorizedAccessException if you have insufficient permissions to commit the group object to Active Directory.

Example

The following code sample illustrates using Commit in a script:

...  
if (objGroup.UnixProfiles.Find(objZone) == null)  
{  
    Console.WriteLine( strGroup + " was not a member of " + strZone);  
    return;  
}  
else  
    // Remove group
    objGroup.RemoveGroupUnixProfile(objZone);  
    objGroup.Commit();  
}  
...