当前位置: 首页 > 知识库问答 >
问题:

Get shared exchange calendar using EWS PowerShell

沈琛
2023-03-14

How would I access a Shared Calendar from Exchange using the EWS or the EWS managed API?I need to be able to read the items from it.

共有1个答案

袁永贞
2023-03-14

Something to start with, maybe?

# Your mailbox here
$mailboxName = "blah@blih.com"

Add-Type -Path "C:\Program Files\Microsoft\Exchange\Web Services\2.0\Microsoft.Exchange.WebServices.dll"  
$version = [Microsoft.Exchange.WebServices.Data.ExchangeVersion]::Exchange2010_SP2  
$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
 类似资料:

相关问答

相关文章

相关阅读