I recently had a requirement where the same calendar items needed to be added to most (but not all) staff personal calendars in Exchange Online. The calendar items were basic all day events without reminders just as a record.
I was able to achieve this using Microsoft Graph PowerShell and a simple CSV.
First off we have the CSV it’s self, it’s a simple list of dates and subjects. I called this file CalendarItems-entries.csv and stored it in the same folder as the script
StartDate,EndDate,Subject,StartDateMinusOne,EndDatePlusOne 2023-05-19T00:00:00,2023-05-20T00:00:00,My Calendar Entry 1,2023-05-18T00:00:00,2023-05-21T00:00:00 2023-06-05T00:00:00,2023-06-06T00:00:00,My Calendar Entry 2,2023-06-04T00:00:00,2023-06-07T00:00:00 2023-06-07T00:00:00,2023-06-08T00:00:00,My Calendar Entry 3,2023-06-06T00:00:00,2023-06-09T00:00:00
Note – I manually entered each items start date, end date, and subject. I also manually ended the date minus one day and plus one day, these are needed to confirm that the calendar entry creates successfully as I found performing Get-MGUserCalendarEvent requests to the normal start date and end date did not return a result.
Yes I could have written something in PowerShell to automate this plus and minus one but I was too lazy.
Now the meat of things, the script. I have this saved as Add-CalendarItems.ps1
https://github.com/SysadminPaul/Scripts/blob/main/ExchangeOnline/Add-CalendarItem.ps1
Leave a Reply