Get Calendar Items & Meeting Details Using PowerShell: Microsoft Graph API (Replacing Legacy EWS Managed API)

✨ Important 2026 Update — Exporting Calendar Items (Graph API vs. Legacy EWS)
  • Exchange Online (Use Microsoft Graph): Basic Auth EWS (WebCredentials) and ApplicationImpersonation are retired in Exchange Online, and EWS itself is being retired. Use Get-MgUserCalendarView (Calendars.Read) in Microsoft Graph PowerShell instead.
  • Date-Range Expansion: Both Graph's calendarView and EWS's CalendarView expand recurring meeting series into individual occurrences within your StartDateTime / EndDateTime window.
  • On-Premises Exchange Only: The legacy EWS Managed API 2.2 script is preserved below for on-premises Exchange Server 2016/2019/SE environments.

Exporting a user's upcoming meetings or auditing room calendar bookings via PowerShell used to require loading Microsoft.Exchange.WebServices.dll (EWS Managed API 2.2) with ApplicationImpersonation.

In Exchange Online (Microsoft 365), Microsoft Graph PowerShell (Get-MgUserCalendarView) is the modern, supported replacement—requiring zero local DLLs and supporting Certificate-Based App-Only Auth with least-privilege Calendars.Read permissions.


POWERSHELL
# Connect to Microsoft Graph (Interactive or Certificate-Based App-Only Auth)
Connect-MgGraph -Scopes "Calendars.Read" -NoWelcome

$Mailbox   = "[email protected]"
$StartDate = (Get-Date).ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ")
$EndDate   = (Get-Date).AddDays(7).ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ")

# Fetch expanded calendar occurrences for the next 7 days
$Events = Get-MgUserCalendarView -UserId $Mailbox -StartDateTime $StartDate -EndDateTime $EndDate -All

$Report = foreach ($Ev in $Events) {
    [PSCustomObject]@{
        Subject        = $Ev.Subject
        StartUtc       = $Ev.Start.DateTime
        EndUtc         = $Ev.End.DateTime
        Organizer      = $Ev.Organizer.EmailAddress.Address
        Location       = $Ev.Location.DisplayName
        IsOnline       = $Ev.IsOnlineMeeting
        Type           = $Ev.Type
        HasAttachments = $Ev.HasAttachments
    }
}

$Report | Format-Table -AutoSize
$Report | Export-Csv -Path ".\$($Mailbox -replace '@.*','')-Meetings.csv" -NoTypeInformation -Encoding UTF8

Need to audit remaining EWS apps before Exchange Online blocks EWS? Read our Audit & Block Legacy EWS Traffic in Exchange Online Guide.


Method 2: Legacy On-Premises Exchange Script (EWS Managed API 2.2)

For on-premises Exchange Server environments where EWS Managed API 2.2 and ApplicationImpersonation are still used:

POWERSHELL
param (
    [string]$Mailbox = "[email protected]",
    [int]$ItemsView = 1000,
    [pscredential]$Credential = (Get-Credential),
    [datetime]$StartDate = (Get-Date),
    [datetime]$EndDate = (Get-Date).AddDays(7),
    [string]$EwsUrl = "https://mail.corp.local/ews/exchange.asmx"
)

$DllPath = "C:\Program Files\Microsoft\Exchange\Web Services\2.2\Microsoft.Exchange.WebServices.dll"
Import-Module $DllPath

$Service = New-Object Microsoft.Exchange.WebServices.Data.ExchangeService([Microsoft.Exchange.WebServices.Data.ExchangeVersion]::Exchange2013_SP1)
$Service.Credentials = New-Object Microsoft.Exchange.WebServices.Data.WebCredentials($Credential.UserName, $Credential.GetNetworkCredential().Password)
$Service.Url = [System.URI]$EwsUrl
$Service.ImpersonatedUserId = New-Object Microsoft.Exchange.WebServices.Data.ImpersonatedUserId([Microsoft.Exchange.WebServices.Data.ConnectingIdType]::SMTPAddress, $Mailbox)

$FolderId = New-Object Microsoft.Exchange.WebServices.Data.FolderId([Microsoft.Exchange.WebServices.Data.WellKnownFolderName]::Calendar, $Mailbox)
$Cal = [Microsoft.Exchange.WebServices.Data.Folder]::Bind($Service, $FolderId)

$CalendarView = New-Object Microsoft.Exchange.WebServices.Data.CalendarView($StartDate, $EndDate, $ItemsView)
$FindCalItems = $Service.FindAppointments($Cal.Id, $CalendarView)

$FindCalItems |
    Select-Object Start, End, Duration, AppointmentType, Subject, Location, Organizer, DisplayTo, DisplayCC, HasAttachments |
    Export-Csv -Path ".\$($Mailbox -replace '@.*','')-Meetings.csv" -NoTypeInformation -Encoding UTF8

References & Official Microsoft Documentation

💬 Reader Comments & Feedback

Did this runbook help, or did Microsoft change a cmdlet or UI menu? Share your feedback below.