4
我試圖從由UserPrincipal實例的GetUnderlyingObject方法返回一個DirectoryEntry
加載屬性physicalDeliveryOfficeName
:UserPrincipal GetUnderlyingObject:屬性中沒有
DirectoryEntry directoryEntry = principal.GetUnderlyingObject() as DirectoryEntry;
這意味着下面的語句返回false:
directoryEntry.Properties.Contains("physicalDeliveryOfficeName");
我知道,使用上述DirectorySearcher
時,可以通過將名稱添加到StringCollection
DirectorySearcher.PropertiesToLoad
加載此屬性。
我的問題是,爲什麼GetUnderlyingObject
方法返回的DirectoryEntry
包含所有屬性?我怎樣才能加載這個屬性,而不使用DirectorySearcher
?
謝謝你的回答!