Reputation: 310
I have an exchange server that list 27 calendars. I need to communicate with this server to figure out what users are assigned to what calendar. I'm not good with PowerShell and i know this can be used to retreive the information i may need. I'd preffer to use Microsoft.Exchange.Webservice.Data but i dont beleive there is a way to retreive this information using this. The code below is what im using to connect with EWS and thus far is not a problem Im just looking for the best way to query what users have access to a calendar.
static void Main(string[] args)
{
ExchangeService service = new ExchangeService (ExchangeVersion.Exchange2010_SP2);
//***********New**********************
ExchangeService mailbox = new ExchangeService(ExchangeVersion.Exchange2010_SP2);
string mailboxEmail = "[email protected]";
WebCredentials wbcred = new WebCredentials("exampleUsername", "examplePassword");
mailbox.Credentials = wbcred;
// mailbox.ImpersonatedUserId = new ImpersonatedUserId(ConnectingIdType.SmtpAddress, mailboxEmail);
mailbox.AutodiscoverUrl(mailboxEmail, RedirectionUrlValidationCallback);
mailbox.HttpHeaders.Add("X-AnchorMailBox", mailboxEmail);
FolderId mb1Inbox = new FolderId(WellKnownFolderName.Inbox, mailboxEmail);
//SetStreamingNotification(mailbox, mb1Inbox);
mailbox.Url = new Uri("https://webmail.example.org/EWS/Exchange.asmx");
Dictionary<string, Folder> x = GetSharedCalendarFolders(mailbox, mailboxEmail);
}
internal static bool RedirectionUrlValidationCallback(string redirectionUrl)
{
//The default for the validation callback is to reject the URL
bool result=false;
Uri redirectionUri=new Uri(redirectionUrl);
if(redirectionUri.Scheme=="https")
{
result=true;
}
return result;
}
Upvotes: 0
Views: 666
Reputation: 174485
In the Exchange Management Shell, you can do:
$CalendarPermissions = Get-MailboxFolderPermission -Identity [email protected]:\Calendar
Which will return all permissions set on the mailbox calendar - each entry has a User
property - the user or group that the permission/access right has been granted to:
$CalendarPermissions | Select User,AccessRights
Upvotes: 1