简体   繁体   English

如何使用C ++ Win32 API在Active Directory中设置和获取多个值(数组值)到单个属性?

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

i am using C++ Win32 API. 我正在使用C ++ Win32 API。

i have done to connect AD using ldap functions & create a attribute. 我已经完成了使用ldap函数连接AD和创建属性的操作。

i done to set & get single values to attributes from AD. 我已经完成设置并从AD获取属性的单个值。

Now,i want to set multiple values in myown attribute.the attribute name is "UsrAttrib". 现在,我想在myown属性中设置多个值。属性名称为“ UsrAttrib”。

how to set array of value into this attribute? 如何将值数组设置为此属性?

And i already tried to get "objectClass" attribute value,using below code. 而且我已经尝试使用以下代码获取“ objectClass”属性值。

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

the attribute actual value is top;person;organizationalPerson;user 属性实际值是top;person;organizationalPerson;user

But usrValue only gives top only. 但是usrValue仅给出top

and i check using ldap_count_values it gives 4 . 我使用ldap_count_values检查它给出4

How to i get all values from that attribute? 我如何从该属性获取所有值?

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. 要获取特定属性的所有值,请在搜索属性的结果上使用ldap_count_valuesldap_get_values 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. 要为特定属性设置多个值,您可以在ldapmod结构的mod_values成员中全部列出它们,或者可以创建多个LDAP_MOD_ADD结构。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM