Get-MgUserCalendarEvent

What is Get-MgUserCalendarEvent?

Get-MgUserCalendarEvent is a Microsoft Graph PowerShell cmdlet used to retrieve events from a specific calendar in a user’s mailbox. It allows administrators to list meetings, appointments, and scheduled events stored in Microsoft 365 calendars.

🚀 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-MgUserCalendarEvent?

This cmdlet is useful for:

  • Auditing user calendar activity
  • Reporting on meetings, schedules, and attendance
  • Automating calendar-based workflows
  • Exporting calendar events for compliance or analysis

It provides detailed event metadata such as start/end time, attendees, organizer, and timestamps, making it ideal for PowerShell-driven reporting.


Prerequisites

Before running this cmdlet, connect to Microsoft Graph with appropriate permissions:

Connect-MgGraph -Scopes "Calendars.Read"

How to use Get-MgUserCalendarEvent?

Basic syntax:

Get-MgUserCalendarEvent -UserId <String> -CalendarId <String>

Use this cmdlet to retrieve all events from a specific user calendar. You can further refine results using filtering or export options.


Get-MgUserCalendarEvent Examples

  • Example 1: Retrieve All Calendar Events
  • Get-MgUserCalendarEvent -UserId "user@example.com" -CalendarId "AAMkAGIAAA"

    This command retrieves all calendar events from the specified calendar of the user. Use Get-MgUser to obtain the User ID or UserPrincipalName.

  • Example 2: Exporting Calendar Events to a CSV File
  • Get-MgUserCalendarEvent -UserId "user@example.com" -CalendarId "AAMkAGIAAA" |
    Export-Csv -Path "C:\Reports\CalendarEvents.csv" -NoTypeInformation
                                                

    This exports all event details—such as created date-time, last modified date-time, and attendee information—to a CSV file for reporting or analysis.

  • Example 3: Retrieve Calendar Events for a Specific Date Range
  • $UserId = "user@domain.com"
    $StartDate = "2025-03-01T00:00:00Z"
    $EndDate = "2025-03-31T23:59:59Z"
    
    Get-MgUserCalendarEvent -UserId $UserId `
    -Filter "start/dateTime ge '$StartDate' and end/dateTime le '$EndDate'"
                                               

    This command retrieves all calendar events that fall within the specified date range.


Summary

Key Point Details
Cmdlet Name Get-MgUserCalendarEvent
Purpose Retrieves events from a user’s calendar
Required Scope Calendars.Read
Key Parameters UserId, CalendarId, Filter
Automation Benefit Enables calendar event reporting and auditing
Common Use Case Exporting or filtering user calendar events

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