【问题标题】:How do i get the SID-History value using c# from active directory如何使用 c# 从活动目录获取 SID-History 值
【发布时间】:2012-11-07 10:06:31
【问题描述】:

我遇到了一个一直在努力解决的问题。 我正在尝试从 AD 搜索结果中获取 sidhistory 属性。 有没有人可以提供一些启示,或者为我指出如何获得 sidhistory 财产价值的正确方向?

这是我所做的一个示例....我遍历属性,但是当我调试代码时没有 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
    }
}

【问题讨论】:

    标签: c# active-directory sid


    【解决方案1】:

    并非所有属性都默认加载,你应该使用 DirectoryEntry 的PropertiesToLoad 属性,见msdn

    【讨论】:

      猜你喜欢
      • 2021-07-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-26
      • 1970-01-01
      • 1970-01-01
      • 2011-07-06
      相关资源
      最近更新 更多