EWS to see shared calendars

Is it possible to use EWS API to see shared calendars that are attached to my outlook profile?

I’m using this code:

# Your mailbox here
$mailboxName = "me@domain.com"

Add-Type -Path "C:\Program Files\Microsoft\Exchange\Web Services\2.2\Microsoft.Exchange.WebServices.dll"  
$version = [Microsoft.Exchange.WebServices.Data.ExchangeVersion]::Exchange2013
$service = new-object Microsoft.Exchange.WebServices.Data.ExchangeService($version)  
$service.UseDefaultCredentials = $true  
$service.AutodiscoverUrl($mailboxName)

$folderid = new-object Microsoft.Exchange.WebServices.Data.FolderId([Microsoft.Exchange.WebServices.Data.WellKnownFolderName]::Calendar, $mailboxName)
$calendarFolder = [Microsoft.Exchange.WebServices.Data.calendarFolder]::Bind($service, $folderid)
$calendarView = new-object Microsoft.Exchange.WebServices.Data.CalendarView([System.DateTime]::Now, [System.DateTime]::Now.AddDays(720))
$calendarView.MaxItemsReturned = 200;
$calendarView.PropertySet = new-object Microsoft.Exchange.WebServices.Data.PropertySet([Microsoft.Exchange.WebServices.Data.BasePropertySet]::FirstClassProperties)
$result = $calendarFolder.FindAppointments($calendarView)

$result | Format-Table

$folderid only returns the generic, ‘calendar’.

Is there a way to pull shared calendars i’ve attached through outlook?

Sorry…I’ve been looking at this too long…

I just realized I was putting my user name in, not the shared mailbox user…works fine :wink: