Forum Discussion
Import Calendar Event CSV File via Powershell to Room Resource Calendar
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-RolandoFeb 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
- IanG5621Oct 04, 2024Copper ContributorHi 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...- l4m3rOct 09, 2024Copper Contributor
this is from chat gpt i suppose and there is no New-ExoMailboxCalendarEvent cmdlet 😄
you can go the way thorug msgraph:
https://learn.microsoft.com/en-us/powershell/module/microsoft.graph.calendar/new-mguserevent?view=graph-powershell-1.0