The Get-MgUserCalendarSchedule cmdlet in Microsoft Graph PowerShell is a versatile tool that retrieves the availability information of a user’s calendar based on specified time intervals. This cmdlet is particularly valuable for automating meeting scheduling and viewing free/busy statuses, making it easier for organizations to coordinate across teams.
Get-MgUserCalendarSchedule -UserId <String> -CalendarId <String> -BodyParameter <IMicrosoftGraphUserCalendarSchedule>
Required Parameters:
To obtain the necessary CalendarId for a user, use the Get-MgUserCalendar cmdlet:
Get-MgUserCalendar -UserId "<UserId>"
$bodyParam = @{
StartTime = @{
DateTime = "2023-10-30T09:00:00"
TimeZone = "Pacific Standard Time"
}
EndTime = @{
DateTime = "2023-10-30T12:00:00"
TimeZone = "Pacific Standard Time"
}
Schedules = @("user1@domain.com")
}
Get-MgUserCalendarSchedule -UserId "user1@domain.com" -CalendarId "<CalendarId>" -BodyParameter $bodyParam
$bodyParam = @{
StartTime = @{
DateTime = "2023-11-01T10:00:00"
TimeZone = "Eastern Standard Time"
}
EndTime = @{
DateTime = "2023-11-01T12:00:00"
TimeZone = "Eastern Standard Time"
}
Schedules = @("user1@domain.com", "user2@domain.com", "user3@domain.com")
}
Get-MgUserCalendarSchedule -UserId "organizer@domain.com" -CalendarId "<CalendarId>" -BodyParameter $bodyParam
$bodyParam = @{
StartTime = @{
DateTime = "2023-11-03T08:00:00"
TimeZone = "GMT Standard Time"
}
EndTime = @{
DateTime = "2023-11-03T11:00:00"
TimeZone = "GMT Standard Time"
}
Schedules = @("userA@domain.com", "userB@domain.com")
}
Get-MgUserCalendarSchedule -UserId "globalteam@domain.com" -CalendarId "<CalendarId>" -BodyParameter $bodyParam
Get-MgUserCalendar
to list a user’s calendars and their associated IDs.BodyParameter
to ensure consistent availability results, especially when working with users across regions.BodyParameter
to reduce response time.Error | Cause | Solution |
Get-MgUserCalendarSchedule : Not Found | Occurs if the UserId or CalendarId is incorrect, or the calendar doesn't exist for the specified user. | Verify that the UserId and CalendarId are correct by using Get-MgUserCalendar. |
AuthenticationFailed | Lack of sufficient permissions or an expired authentication session. | Ensure the account has Calendars.Read or Calendars.Read.Shared permissions, and re-authenticate if necessary. |
BadRequest: Invalid request | Malformed BodyParameter , such as incorrect date format or missing required fields. |
Confirm BodyParameter structure to ensure StartTime, EndTime, and Schedules are correctly formatted. |
The Get-MgUserCalendarSchedule cmdlet is an invaluable tool for managing and coordinating schedules within Microsoft 365. With flexibility to check multiple users' availability, it enhances productivity by automating the scheduling process for meeting coordination, support planning, and global team scheduling. Be sure to check permissions and ensure correct parameter formatting to avoid common errors.
© m365corner.com. All Rights Reserved. Design by HTML Codex