I am trying to get a list of delegates who have either editor or author permissions to the calendar of certain users. I have tried to use the Exchange Web Services (EWS) API but I don't appear to have the correct level of permissions to be able to query for that. Here is the code I'm using:
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 code above results in the following exception which I'm guessing is permissions-related: "The specified object was not found in the store."
As an alternative, I then tried to use the System.DirectoryServices namespace (DirectoryEntry, DirectorySearcher along with the FindOne method) to query Active Directory (AD) for a list of delegates for a given user. I found the publicdelegates property but that seems to get me a list of all delegate names and doesn't contain any additional information about the specific level of permissions that each delegate has. I was hoping to only get a list of delegates who have editor or author permissions.
Any suggestions? Thanks in advance.
You can use the Exchange Management Shell and Get-MailboxFolderPermission https://learn.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://learn.microsoft.com/en-us/previous-versions/office/developer/exchange-server-2010/ff326159(v%3Dexchg.140)