0

i am using C++ Win32 API.

i have done to connect AD using ldap functions & create a attribute.

i done to set & get single values to attributes from AD.

Now,i want to set multiple values in myown attribute.the attribute name is "UsrAttrib".

how to set array of value into this attribute?

And i already tried to get "objectClass" attribute value,using below code.

usrValue = ldap_get_values(
                          pLdapConnection,  // Session Handle
                          pEntry,           // Current entry
                          "ObjectClass");

the attribute actual value is top;person;organizationalPerson;user

But usrValue only gives top only.

and i check using ldap_count_values it gives 4.

How to i get all values from that attribute?

Arjun babu
  • 607
  • 2
  • 13
  • 42

1 Answers1

1

To get all of the values of a particular attribute use ldap_count_values and ldap_get_values on the result of a search for the attribute. See the Searching a Directory example.

To set multiple values for a particular attribute you can list them all in the mod_values member of the ldapmod structure, or you can create multiple LDAP_MOD_ADD structures.

Neil
  • 54,642
  • 8
  • 60
  • 72
  • @SanjuMonu What do you mean by `usrValue` only gives "top"? It's an array, so `usrValue[0]` should be "top", `usrValue[1]` should be "person" etc. – Neil Nov 07 '12 at 21:59