我正在创建一个需要获取每个邮箱权限的应用程序,而我似乎无法使其正常工作。我已经在VS对象浏览器中注意到Permissions属性位于Folder类上。

所以我想我需要获取MailBox对象,然后获取根目录/默认文件夹,以便获得权限。

到目前为止,这是我所做的,但是当它调用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)文件夹”根文件夹时,传递ExchangeVersion.Exchange2007_SP1确实可行。
Folder rootfolder = Folder.Bind(service, WellKnownFolderName.PublicFoldersRoot);

所以问题是如何使用EWS获得邮箱权限?

最佳答案

我刚刚找到了Find out which users have Full Access on a mailbox帖子,上面写着

因此,似乎无法使用EWS获得邮箱权限。
耻辱。

关于c# - 使用EWS获取邮箱权限,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/30509909/

10-10 18:24
查看更多