Forum Discussion
Matt-Rolando
Feb 08, 2024Copper Contributor
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 ...
LeonPavesic
Feb 09, 2024Silver 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
Matt-Rolando
Feb 13, 2024Copper Contributor
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