ฉันกำลังพยายามรับคุณลักษณะผู้ใช้บางอย่างจาก Active Directory โดยใช้ Windows LDAP API ฉันใช้:
- เวอร์ชัน Active Directory: เวอร์ชันที่มาพร้อมกับ Windows Server 2012
- เวอร์ชัน LDAP: 3
- เวอร์ชัน Wldap32.lib: เวอร์ชันที่มาพร้อมกับ Windows 10 x64
Eg:
PCHAR myAttributes[4];
myAttributes[0] = "DistinguishedName";
myAttributes[1] = "DisplayName";
myAttributes[2] = "PasswordExpired";
myAttributes[3] = "mail";
ldap_search_s(
myLdapConnection, // Ldap connection
myDomain, // DN to start search
LDAP_SCOPE_SUBTREE, // Scope
myFilter, // Filter
myAttributes, // Retrieve list of attributes
0, // Get both attributes and values
&mySearchResult // [out] Search results
);
ส่งคืนแอตทริบิวต์ DistinguishedName
, DisplayName
และ mail
แต่จะไม่ส่งคืนแอตทริบิวต์ PasswordExpired
ฉันสอบถามด้วยแอตทริบิวต์อื่นๆ และดูเหมือนว่าจะไม่ส่งคืนแอตทริบิวต์ที่มีค่าบูลีนเช่นเดียวกับแอตทริบิวต์ EmailAddress
- เหตุใดจึงไม่ส่งคืนแอตทริบิวต์
PasswordExpired
- แล้ว
EmailAddress
ล่ะ? - มีความแตกต่างระหว่าง
EmailAddress
และmail
หรือไม่?