Set the values for all of the required attributes for the
object using the IADs.Put or
IADs.PutEx method. The
attributes required to create an object will depend on the
directory service and the type of object created. For more
information about creating Active Directory objects, see Creating
and Deleting Active Directory Objects.
Set the values for all of the desired optional attributes for
the object using the IADs.Put or IADs.PutEx
method.
Call the IADs.SetInfo
method to commit the object and its attributes. The new object is
not actually created in the underlying directory service until the
IADs.SetInfo method is called to commit the attributes.
Creating an Object with IDirectoryObject
To create an
object with the IDirectoryObject interface
Bind to the container that will contain the object to be
created and obtain the IDirectoryObject interface.
Allocate an array of ADS_ATTR_INFO structures that
contains one structure for each attribute to be set when the object
is created.
Fill in an ADS_ATTR_INFO structure for each required
attribute for the object. The attributes required to create an
object will depend on the directory service and the type of object
created. For more information about creating Active Directory
objects, see Creating
and Deleting Active Directory Objects.
Fill in an ADS_ATTR_INFO structure for each optional
attribute for the object.
Use the IDirectoryObject::CreateDSObject
method to create the object in the container. This method also
commits the object to the underlying directory service. If the
ADS_ATTR_INFO array does not contain all of the required
attributes for the object, IDirectoryObject::CreateDSObject
will fail.
What happens to a deleted object depends on the underlying
directory service. For more information about deleting Active
Directory objects, see Creating
and Deleting Active Directory Objects.