列出ACL的所有成员的c#代码

本文关键字:代码 成员 ACL 列出 | 更新日期: 2023-09-27 18:08:30

我有下面的VB脚本代码,我希望它是在c# DOT . NET。代码的目的是从LDAP中列出特定ACL的所有成员。有谁能帮我吗?

    VB Script:
    Const ADS_SCOPE_SUBTREE = 2
    Const adVariant = 12
    iCount = 0
    Set objConnection = CreateObject("ADODB.Connection")
    Set objCommand = CreateObject("ADODB.Command")
    objConnection.Provider = "ADsDSOObject"
    objConnection.Open "Active Directory Provider"
    Set objCommand.ActiveConnection = objConnection
    objCommand.CommandText = "Select member from 'LDAP://DC=xxx,DC=yyy,DC=zz,DC=com' where objectClass='group' and name = '" & txtACLName.Text & "'"
    objCommand.Properties("Page Size") = 1000
    objCommand.Properties("Timeout") = 30
    objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
    objCommand.Properties("Cache Results") = False
    Set objRecordSet = objCommand.Execute
    objRecordSet.MoveFirst
    strMembers = ""
    Do Until objRecordSet.EOF
        For i = 0 To objRecordSet.Fields.Count - 1
            arrField = objRecordSet.Fields(i)
            If IsArray(arrField) Then
                For Each strItem In arrField
                    sUser = GetUserId(strItem)

列出ACL的所有成员的c#代码

你可以在下面的链接找到你的答案。

http://www.codeproject.com/Articles/18102/Howto-Almost-Everything-In-Active-Directory-via-C