Platform SDK: Active Directory, ADSI, and Directory Services |
The IADs::Put method saves the value for a property for an Active Directory object by name into the property cache. Use IADs::PutEx to save multi-valued properties to the property cache, or to remove a property from an object. These values are not persisted to the underlying directory service until IADs::SetInfo is called.
Dim Namespace As IADsOpenDSObject Dim User As IADsUser Dim NewName As Variant Set Namespace = GetObject("LDAP:") Set User = Namespace.OpenDSObject("LDAP://MyMachine/CN=Administrator,CN=Users,DC=MyDomain,DC=Microsoft,DC=COM", "Administrator", "", ADS_SECURE_AUTHENTICATION) NewName = "John Smith" ' Set using IADs::PutMethod User.Put "FullName", NewName User.SetInfo
The following code example shows how to use IADs::Put with a single value.
Dim x As IADs Set x = GetObject("LDAP://CN=JSmith,CN=Users,DC=Microsoft, DC=Com") x.Put "givenName", "John" x.Put "sn", "Smith" 'Commit to the directory x.SetInfo
The following code example shows how to use IADs::Put with multiple values.
Dim x As IADs Set x = GetObject("LDAP://CN=JSmith,CN=Users,DC=Microsoft, DC=Com") x.Put "givenName", "John" x.Put "sn", "Smith" x.SetInfo 'Commit to the directory.