How to set and get multiple values(array values) to Single attribute in Active Directory using C++ win32 API?

StackOverflow https://stackoverflow.com/questions/13253293

Question

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?

Était-ce utile?

La solution

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.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top