Forum Discussion

Matt-Rolando's avatar
Matt-Rolando
Copper Contributor
Feb 08, 2024

Import Calendar Event CSV File via Powershell to Room Resource Calendar

Greetings all,

Here's what I am trying to do: We manage our room scheduling with our student management system. I can export room schedule information to a CSV file. I need to be able to import this CSV file to Exchange 365, into a Room Resource Mailbox. We have all of our rooms set up as Resources in Exchange 365, and we have a meeting room display system that shows room availability via displays outside each room. I would like to set up the CSV import via Powershell so my users can schedule rooms in one place and it automatically populate to the Room Resource Calendar.

Thanks for the help...

 

TLDR: Need to import CSV calendar events via PowerShell into a room resource calendar. What's the best way? 🙂

5 Replies

  • LeonPavesic's avatar
    LeonPavesic
    Silver Contributor

    Hi Matt-Rolando,

    to import a event to a Resource Mailbox (Room) form a CSV file with PowerShell, you can use this:

    # Connect to Exchange Online
    Connect-ExchangeOnline
    
    # CSV File - Path to your file
    $csvFilePath = "C:\Path\To\Your\File.csv"
    
    # Your Room Resource Mailbox
    $roomResource = "email address removed for privacy reasons"
    
    # Import Calendar Event from CSV
    $calendarEvents = Import-Csv $csvFilePath
    
    foreach ($event in $calendarEvents) {
        $subject = $event.Subject
        $start = Get-Date $event.StartTime -Format "yyyy-MM-ddTHH:mm:ss"
        $end = Get-Date $event.EndTime -Format "yyyy-MM-ddTHH:mm:ss"
    
        # Create and Import Calendar Event
        New-ExoMailboxCalendarEvent -Mailbox $roomResource -Subject $subject -Start $start -End $end -Location $event.Location -Details $event.Description
    }
    
    # Disconnect from Exchange Online
    Disconnect-ExchangeOnline -Confirm:$false


    Please click Mark as Best Response & Like if my post helped you to solve your issue.
    This will help others to find the correct solution easily. It also closes the item.


    If the post was useful in other ways, please consider giving it Like.


    Kindest regards,


    Leon Pavesic
    (LinkedIn)
    (Twitter)

    • Matt-Rolando's avatar
      Matt-Rolando
      Copper Contributor

      LeonPavesic 

       

      Thanks for the code Leon.  I had run across this Exchange Online Module before, and it doesn't work.  The New-EXOMailboxCalendarEvent is not recognized.  I have installed the Exchange Online Management modules, and this function is not listed.  I can not even find a reference to how it is implemented.  Everything I have found to try and accomplish this function has not worked.  I am beginning to think it is not possible.

       

      Matt

      • IanG5621's avatar
        IanG5621
        Copper Contributor
        Hi Matt,

        I have a similar use case. Did you ever find a solution to this?

        I have a few teams rooms calendars for classrooms. I am looking for a way to bulk load events to the room calendar for the semester but still keep the ability for others to book the room around the scheduled classes.

        Thanks
        Ian...

Resources