Skip Navigation Links
Home
+
About
+
Products
+
Support
+
Purchase
+
Search
+
Add (Method of LDAPAttributeCollection)
Insert a new attribute into the directory with a string value, using UTF-8 and Unicode translation as necessary.
Syntax
Add(AttributeName As String, Value As String) As LDAPAttribute
Remarks
The Add method creates a new attribute in the directory. If the server rejects attribute name or value data, a trappable error will occur. Non-ASCII characters are allowed in the value, as long as they are passed in Unicode format (in Visual Basic these are normal Strings). All non-ASCII characters are UTF8-encoded before being saved in the directory. Note that some directory servers do not follow the convention of passing multibyte characters in UTF-8 when using the LDAP protocol. One such directory service is Microsoft Active Directory. In the cases of these servers, it is necessary to manually encode the string using the server's encoding and then use the AddNoTrans method instead.
Example
Set pLDAP = CreateObject("LDAPClient.3")
Call pLDAP.Connect("ldapserver")

Set pEntries = pLDAP.Search("o=airius.com", "uid=printer1")

' Give printer1 a description, since it doesn't have one yet.
Call pEntries(0).Attributes.Add("description", "Color laser printer 1200 dpi. Reserved for documentation use between 5 and 6pm.")