繁体   English   中英

我如何使用 C# 从活动目录中获取 SID-History 值

[英]How do i get the SID-History value using c# from active directory

我有一个问题,我一直在努力解决。 我正在尝试从 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
    }
}

默认情况下并非所有属性都加载,您应该使用 DirectoryEntry 的PropertiesToLoad属性,请参阅msdn

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM