我嘗試寫,當我嘗試下一個用戶執行這個過程,它取得的可用DirectoryEntry
如何從DirectoryEntry對象
// create LDAP connection object
DirectoryEntry myLdapConnection = createDirectoryEntry();
// create search object which operates on LDAP connection object
// and set search object to only find the user specified
DirectorySearcher search = new DirectorySearcher(myLdapConnection);
search.Filter = "(cn=" + username + ")";
// create results objects from search object
SearchResult result = search.FindOne();
if (result != null)
{
// user exists, cycle through LDAP fields (cn, telephonenumber etc.)
ResultPropertyCollection fields = result.Properties;
foreach (String ldapField in fields.PropertyNames)
{
// cycle through objects in each field e.g. group membership
// (for many fields there will only be one object such as name)
foreach (Object myCollection in fields[ldapField])
Console.WriteLine(String.Format("{0,-20} : {1}",
ldapField, myCollection.ToString()));
}
}
else
{
// user does not exist
Console.WriteLine("User not found!");
}
所有屬性的程序獲得所有屬性,它返回我屬性列表,但當我嘗試在不同的用戶下執行此過程時,它會返回不同數量的屬性。
我需要什麼樣的授權,以獲得所有屬性?提前
感謝
了Kobi