The ModifyObject method MUST execute an LDAP command under machine security credentials to add, delete, or modify attributes of an Active Directory object that has a specified distinguished name.<48>

 HRESULT ModifyObject(
   [in] BSTR domainControllerName,
   [in] BSTR distinguishedName,
   [in] SAFEARRAY (_AdAttributeData)* attributes
 );

domainControllerName: MUST be the FQDN of the domain controller to which the method sends the LDAP request. The format of the distinguished name is specified in [RFC2251] section 4.1.3.

distinguishedName: MUST be the distinguished name of the Active Directory object being modified. The distinguished name of any object in Active Directory MAY be used. <49>

attributes: MUST be the safe array of attributes that are to be added, modified, or deleted.

Return Values: The method MUST return:

After the server receives this message, it MUST check whether the caller has sufficient rights to perform the operation. The implementation MUST perform a platform-specific check to verify that the rights are appropriate for the modification of Active Directory objects.

If the security check succeeds and the server can verify that the user has sufficient rights, the server MUST proceed to the next steps of the method.

When the server receives this message, it MUST validate the parameters:

If parameter validation fails, the server MUST fail the operation immediately and return an appropriate error as its response to the client.

If both the security check and the parameter validation succeed, the server MUST create a new LDAP command for modifying an existing Active Directory object that has the specified distinguished name and attributes.

The server MUST execute this LDAP command against the domain controller that is specified in domainControllerName and check the return value of the LDAP protocol.

If the LDAP protocol returns LDAP_SUCCESS, the server MUST return zero to the caller to indicate the success of the call; otherwise, if the LDAP protocol returns any return code other than LDAP_SUCCESS, the server MUST return the following error code to the caller: