Sysadmin Paul

Guides on all things sysadmin and tech related

  • Exchange Online – Add items to users calendars

    April 1, 2023
    Scripts
    Exchange Online – Add items to users calendars

    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

    Exchange Online, Microsoft Graph, PowerShell
    Next

    Leave a Reply Cancel reply

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

About

Hi I’m Paul. I’ve worked in the IT sector for 15+ years, this blog is a place for me to share guides/tutorials with a focus on M365, Azure, Docker, and PowerShell.

  • LinkedIn
  • GitHub

Recent Posts

  • Azure audit logs – Last user to logon to a computer
  • Report Intune Configuration Policies assigned to devices
  • What is Docker Compose?
  • Setup New Ubuntu Server
  • Beginners guide to Docker

Copyright © 2023 Sysadmin Paul