我需要在用户帐户对象上撤回活动目录属性“msExchMailboxSecurityDescriptor”的安全描述符。
到目前为止,我所能找到的只是我需要use this class to do so,但我找不到任何示例代码,说明如何开始使用它来拉动我想要的东西。
我只能使用.Net v2.0。
有经验或想法的人吗?
答案 0 :(得分:0)
使用ActiveDS COM组件,似乎更简单:
Imports ActiveDS
Private Function GetSecurityDescriptor(ByVal DNPath As String) As List(Of AccessControlEntry)
Dim AceList As New List(Of AccessControlEntry)
Try
Dim ent As New DirectoryEntry(String.Format("LDAP://{0}", DNPath))
Dim sd As SecurityDescriptor = CType(ent.Properties("msExchMailboxSecurityDescriptor").Value, SecurityDescriptor)
Dim acl As AccessControlList = CType(sd.DiscretionaryAcl, AccessControlList)
Dim ace As AccessControlEntry
For Each ace In CType(acl, IEnumerable)
AceList.Add(ace)
Next
Catch ex As Exception
Return AceList
End Try
Return AceList
End Function