Imagine that you have a monitoring script written in PowerShell that checks the memory, CPU, or disk utilization on all of your Exchange servers. In addition to alerting your team to any critical problems via e-mail, it might also be nice to schedule a reminder in the future for noncritical issues by creating a calendar item in one or more mailboxes. The EWS Managed API makes it easy to create a calendar item through PowerShell using just a few commands.
Let's see how to create calendar items using the following steps:
First, load the assembly, create the
ExchangeService
object, and connect to EWS:Add-Type -Path C:\EWS\Microsoft.Exchange.WebServices.dll $svc = New-Object Microsoft.Exchange.WebServices.Data.ExchangeService $svc.AutoDiscoverUrl("[email protected]")
Next, create a new appointment object:
$appt = New-Object -TypeName ' Microsoft.Exchange.WebServices.Data.Appointment ' -ArgumentList $svc
Fill out the subject and body for the appointment...