C# 从 Exchange 中获取详细的委托信息

C# Get Detailed Delegate Information from Exchange

我正在尝试获取对某些用户的日历具有编辑或作者权限的代表列表。我已尝试使用 Exchange Web 服务 (EWS) API,但我似乎没有正确级别的权限来查询它。这是我正在使用的代码:

ExchangeService service = new ExchangeService();
service.UseDefaultCredentials = true;
service.Url = new Uri("https://mailurl/Exchange.asmx");

Mailbox mailbox = new Mailbox("some_user@some_domain.com");
var result = service.GetDelegates(mailbox, true);

上面的代码导致以下异常,我猜这是与权限相关的:"The specified object was not found in the store."

作为替代方案,我然后尝试使用 System.DirectoryServices 命名空间(DirectoryEntry、DirectorySearcher 以及 FindOne 方法)来查询 Active Directory (AD) 以获取给定用户的委托列表。我找到了 publicdelegates 属性 但这似乎让我得到了一个 all 委托名称的列表并且不包含任何关于每个代表拥有的特定级别的权限。我希望只得到一份拥有编辑或作者权限的代表名单。

有什么建议吗?提前致谢。

您可以使用 Exchange 管理 Shell 和 Get-MailboxFolderPermission https://docs.microsoft.com/en-us/powershell/module/exchange/mailboxes/get-mailboxfolderpermission?view=exchange-ps which will allow you to get just the permissions set on the Calendar Folder itself. The problem with using delegates like the above that this will only capture Outlook delegates but users may have still been explicitly grant rights to a folder by either the user or an Admin. To run the above from Managed Code you just need something like https://docs.microsoft.com/en-us/previous-versions/office/developer/exchange-server-2010/ff326159(v%3Dexchg.140)