我正在创建一个需要获取每个MailBox权限的应用程序,而我似乎无法让它工作。我在VS对象浏览器中注意到Permissions属性在Folder类上。
所以我猜我需要获取MailBox对象,然后获取root / default文件夹,以便获得权限。
这是我到目前为止所做的,但当它调用Folder rootfolder = Folder.Bind(service, sharedMailboxRootFolderId);
时,我得到以下异常:
“客户端访问服务器版本与访问的版本不匹配 资源的邮箱服务器版本。“
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2007_SP1);
string exchangeServerWebServicesUrl = "https://example.com/EWS/Exchange.asmx";
service.Url = new Uri(exchangeServerWebServicesUrl);
string username = "*********************";
string password = "*********************";
service.UseDefaultCredentials = false;
service.Credentials = new WebCredentials(username, password);
Mailbox sharedMailbox = new Mailbox("shared@example.com");
FolderId sharedMailboxRootFolderId = new FolderId(WellKnownFolderName.Root, sharedMailbox);
Folder rootfolder = Folder.Bind(service, sharedMailboxRootFolderId);
var permissions = rootfolder.Permissions;
我尝试传入不同的ExchangeVersion枚举值,但它们也不起作用。但是当我尝试获取Public Folders根文件夹时,传递ExchangeVersion.Exchange2007_SP1确实有效。
Folder rootfolder = Folder.Bind(service, WellKnownFolderName.PublicFoldersRoot);
所以问题是如何使用EWS获得MailBoxes权限?
答案 0 :(得分:4)
我刚刚发现了Find out which users have Full Access on a mailbox帖子
您无法使用EWS(或任何Exchange邮箱API) 只访问文件夹级别DACL您需要阅读的是 邮箱DACL只能通过Exchange访问 管理外壳(Get-MailboxPermissions)或通过阅读 来自Active Directory的msexchmailboxsecuritydescriptor。
因此看起来无法使用EWS获取MailBox权限。 羞。