Hello Edwin J. Wensley,
I understand you are trying to create a calendar event using New-MgUserEvent
, but the event is always created at the next 30-minute time block, and the time or time zone you provide is ignored.
This is a known issue in the Microsoft Graph PowerShell SDK and has been reported by other users as well.
You can track the issue on GitHub here:
https://github.com/microsoftgraph/msgraph-sdk-powershell/issues/3271
Until the fix is released, you can use Invoke-MgGraphRequest
to create the event correctly. Here's how you can do it using the same input values from your original script:
$TenantId = "tenantId"
$ClientId = "appId"
$Thumbprint = "thumbprint"
Connect-MgGraph -TenantId $TenantId -ClientId $ClientId -CertificateThumbprint $Thumbprint
$UserId = "******@xxxxxxxxxxx.onmicrosoft.com"
$EventPayload = @{
subject = "Sample Test Event"
start = @{
dateTime = "2025-04-17T14:00:00"
timeZone = "Eastern Standard Time"
}
end = @{
dateTime = "2025-04-17T15:00:00"
timeZone = "Eastern Standard Time"
}
} | ConvertTo-Json -Depth 10
Invoke-MgGraphRequest -Method POST `
-Uri "https://graph.microsoft.com/v1.0/users/$UserId/events" `
-Body $EventPayload `
-ContentType "application/json
This will create the event at the correct time using the exact values you specify.
Hope this helps!
If this answer was helpful, please click "Accept the answer" and mark Yes
, as this can help other community members.
If you have any other questions or are still experiencing issues, feel free to ask in the "comments" section, and I'd be happy to help