2012-11-07 37 views
0

我遇到了一直困擾我的問題。 我正在嘗試從AD搜索結果中獲得sidhistory屬性。 有沒有人可以說出一些光明,或者指出我如何獲得史前財產價值的正確方向?如何從活動目錄中使用c#獲取SID-History值

這是我做的一個例子....我遍歷屬性,但是當我調試代碼時沒有sidhistory屬性。

using (DirectoryEntry directoryEntryUser = new DirectoryEntry(searchResult.Path)) 
{ 
    foreach (string propertyName in directoryEntryUser.Properties.PropertyNames) 
    { 
      PropertyValueCollection propertyValues = 
      directoryEntryUser.Properties[propertyName]; 
      // And the rest of the code goes here 
      // to get the values. 
      // Sid-History or any variation never displays here 
      // as a property name 
      // however objectsid does display 
    } 
} 

回答

0

並非所有屬性都默認加載,你應該使用的DirectoryEntry的PropertiesToLoad性質,見msdn

相關問題