Partager via


EWS script to create an appointment in a set of mailboxes defined in a CSV file using an impersonation account

A customer recently wanted a script that would allow him to create an appointment with a reminder in a set of mailboxes that he defined in a CSV file. I was happy to oblige and this is the result. My script is based off of https://mikepfeiffer.net/2011/01/creating-calendar-items-with-powershell-and-the-ews-managed-api/. I wanted to post my script as it does do a couple of things differently:

  • has reminder support
  • has free/busy status support
  • it's a script rather than a cmdlet
  • has logging so you know against which mailboxes the script worked
  • it's been validated against Office 365

To run the script, you must:

  1. Allow execution of unsigned PowerShell scripts: Set-ExecutionPolicy unrestricted
  2. Install the EWS Managed API 2.2 from https://www.microsoft.com/en-us/download/details.aspx?id=42951
  3. Create an impersonation account using https://msdn.microsoft.com/en-us/library/office/dn722376%28v=exchg.150%29.aspx
  4. Create a CSV file where one of the columns has a header named EmailAddress

Notes:

  • There should be no throttling concerns as impersonated actions are counted against the target user's throttling policy rather than the impersonation account.
  • This script should work against any modern versions of Exchange.

CreateAppointmentItem.ps1