Get-MgUserCalendar

What is Get-MgUserCalendar?

Get-MgUserCalendar is a Microsoft Graph PowerShell cmdlet used to retrieve calendar objects from a user’s mailbox. It allows administrators to list all calendars or fetch details of a specific calendar associated with a Microsoft 365 user.

🚀 Community Edition Released!

Try the M365Corner Microsoft 365 Reporting Tool — your DIY pack with 20+ out-of-the-box M365 reports for Users, Groups, and Teams.

Why Use Get-MgUserCalendar?

This cmdlet is useful for:

  • Auditing user calendars in Microsoft 365
  • Identifying default, shared, or custom calendars
  • Supporting reporting, troubleshooting, or automation workflows
  • Preparing calendar data for downstream actions such as event queries or exports

It enables PowerShell-based visibility into user calendar configurations without manual mailbox access.


Prerequisites

Before running this cmdlet, ensure you are connected to Microsoft Graph with the required permissions:

Connect-MgGraph -Scopes "Calendars.Read"

How to use Get-MgUserCalendar?

Basic syntax:

Get-MgUserCalendar -UserId <String> [-CalendarId <String>] [-Filter <String>]

Use this cmdlet to retrieve all calendars for a user, fetch a single calendar by ID, or filter calendars based on properties.


Get-MgUserCalendar Examples

  • Example 1: Retrieve All Calendars for a User
  • Get-MgUserCalendar -UserId "john.doe@contoso.com" -All

    This command fetches all calendars that belong to the specified user.

  • Example 2: Retrieve Details of a Single Calendar
  • Get-MgUserCalendar -UserId "john.doe@contoso.com" -CalendarId "AAMkAGI2AAAxZDI3LTQzZGYtNDMzZS05NzA2LTYwOTk5ZTVhN2I4YQBGAAAAAADJW7MCAp_Ob2JrAK3w_8QHBgA9DxCtv2LSQJ-KHyt7AAAAAAEQAAC7c6jIHwQjQZMIm50isAAQGo_9_AAA="

    This retrieves detailed information for a specific calendar.

  • Example 3: Using -Filter to Retrieve Specific Calendars
  • Get-MgUserCalendar -UserId "john.doe@contoso.com" -Filter "name eq 'Birthdays'"

    This command returns the calendar named Birthdays, if present.

  • Example 4: Export Calendar Data to a CSV File
  • $calendars = Get-MgUserCalendar -UserId "john.doe@contoso.com" -All
    $calendars | Export-Csv -Path "C:\Reports\UserCalendars.csv" -NoTypeInformation
                                                

    This script exports all user calendar data to a CSV file for reporting or analysis.


Summary

Key Point Details
Cmdlet Name Get-MgUserCalendar
Purpose Retrieves calendar objects from a user mailbox
Required Scope Calendars.Read
Key Parameters UserId, CalendarId, Filter
Automation Benefit Enables calendar auditing and reporting via PowerShell
Common Use Case Listing, filtering, or exporting user calendars

Did You Know? Managing Microsoft 365 applications is even easier with automation. Try our Graph PowerShell scripts to automate tasks like generating reports, cleaning up inactive Teams, or assigning licenses efficiently.

Ready to get the most out of Microsoft 365 tools? Explore our free Microsoft 365 administration tools to simplify your administrative tasks and boost productivity.

© Your Site Name. All Rights Reserved. Design by HTML Codex