如何列出已分配给域用户邮箱的权限?
例如,在 AD 用户和计算机的“交换的高级”选项卡的“邮箱权限”部分中指定的帐户?
哟,这是很恶心的东西。由于没有 .NET 包装器(上次我检查过,那是在 1.1 发呆),您需要使用 CDOEXM 进行 COM 互操作。
下面是一些伪代码,我希望它能让你在我的 brutha 中抢先一步:
DirectoryEntry userDirectoryEntry; // you need to new this up
IExchangeMailbox exchangeMailbox = (IExchangeMailbox)userDirectoryEntry.NativeObject;
IADsSecurityDescriptor securityDescriptor = (IADsSecurityDescriptor) exchangeMailbox.MailboxRights;
IADsAccessControlList acl = (IADsAccessControlList) securityDescriptor.DiscretionaryAcl;
// Iterate thru each ACE in the ACL
foreach ( IADsAccessControlEntry ace in acl)
{
// in here, you'll have access to each "ace"
}