PowerShell: Script to import calendar items into Exchange mailbox from CSV file No ratings yet.

0

A recent case brought up the question of whether it is possible to import calendar items into a mailbox from a text file using PowerShell.  While there aren’t any cmdlets built-in that support this, it is certainly possible to implement this using PowerShell and the EWS Managed API.  Sample script is attached, and the syntax is:

 

Import-CalendarCSV -CSVFileName <string> -EmailAddress <string> [-Username <string> -Password <string> [-Domain <string>]] [-Impersonate <bool>] [-EwsUrl <string>] [-EWSManagedApiPath <string>]

Parameters:

(Required)

-CSVFileName
Filename of the CSV file to import appointments for this user from.

-EmailAddress
Mailbox SMTP email address

(Optional)

-Username
Username for the account being used to connect to EWS (if not specified, current user is assumed)

-Password
Password for the specified user (required if username specified)

-Domain
If specified, used for authentication (not required even if username specified)

-Impersonate
Set to $true to use impersonation.

-EwsUrl
Forces a particular EWS URl (otherwise autodiscover is used, which is recommended)

-EWSManagedApiDLLFilePath
Full and path to the DLL for EWS Managed API (if not specified, default path for v1.1 is used)

Example

To process the CSV file c:\calendar.csv and import all entries into the mailbox of user@domain.com, you would use the following command:

Import-CalendarCSV -CSVFileName c:\calendar.csv -EmailAddress user@domain.com

The CSV needs to be in the format Subject, Start Date, Start Time, End Date, End Time.

Other fields can be added, and if this is the case you will need to add a header row to the CSV file.  The headers need to include the five required fields (Subject, Start Date, Start Time, End Date, End Time) and any other fields you like.  You should be able to use any of the fields listed here as additional fields, so long as they are simple (i.e. just contain a single value); this means that you can’t specify Attachments, for example.

Import-CalendarCSV.zip

0

Please rate this

1 thought on “PowerShell: Script to import calendar items into Exchange mailbox from CSV file

  1. Hello David,

    I used your script for 4 years but now that we have migrated to Office 365 it’s not working anymore. Do you have some tips or something similar to propose to the community ?

    Best regards.

    zigune

    0

Leave a Reply

Your email address will not be published. Required fields are marked *