New/Update-MgUserEvent only updates Subject and ShowAs

Edwin J. Wensley 26 Reputation points
2025-04-15T18:03:41.5866667+00:00

Here's a portion of the code to create a new calendar event:

Connect-MgGraph -TenantId $TenantId -ClientId $ClientId -CertificateThumbprint $Thumbprint
$User = Get-MgUser -UserId "******@contoso.com"
$startDateTime = @{
DateTime = "2025-04-15T14:00:00"
TimeZone = "Eastern Standard Time"
}
$endDateTime = @{
DateTime = "2025-04-15T15:00:00"
TimeZone = "Eastern Standard Time"
}
$NewEvent = @{
Start = $startDateTime
End = $endDateTime
Subject = "Sample Test Event"
}
$createEvent = New-MgUserEvent -UserId $User.Id -BodyParameter $NewEvent

This creates a new calendar event but not using the correct time; it creates a 30-minute event at the next 30-minute block (e.g., at 1:44, it will create a 2:00-2:30 event). Similarly, when I use Update-MgUserEvent, it only changes the subject regardless of any other properties I request to change. I tested updating most of the fields, and the only ones that would change were Subject and ShowAs (though I don't care about changing the value for ShowAs). Connect-MgGraph app permissions are Calendars.Read, Calendars.ReadBasic.All, Calendars.ReadWrite, and User.Read.All. No errors are reported; it just doesn't create or update anything except for the Subject (and ShowAs).

Microsoft Security | Microsoft Entra | Microsoft Entra ID
0 comments No comments
{count} votes

Accepted answer
  1. SrideviM 5,715 Reputation points Microsoft External Staff Moderator
    2025-04-17T06:52:50.49+00:00

    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
    
    

    enter image description here

    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.

    User's image

    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

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.