Skip to content

New-MgUserEvent and New-MgUserCalendarEvent ignore time zone and start/end dates #3271

Closed
@12Knocksinna

Description

@12Knocksinna

Describe the bug

This bug might be linked to #3223

If you run the New-MgUserEvent or New-MgUserCalendarEvent cmdlets to create a new event in a calendar, the cmdlets ignore the time zone and start and date passed in the payload and create an event that's in the next 30-minute slot in the target calendar.

Expected behavior

Obviously, calendar events should be scheduled for when they're supposed to happen.

How to reproduce

  1. Create the payload. Here's one for a simple appointment:

$UserId = (Get-MgUser -UserId (Get-MgContext).Account).Id

Create simple calendar appointment

$EventBody = @{}
$EventBody.Add("contentType", "HTML")
$EventBody.Add("content", "The TEC 2025 comference event starts with registration and breakfast at 8:30AM. The first session will commence at 9:30AM")

$EventStart = @{}
$EventStart.Add("dateTime", "2025-09-30T09:00:00")
$EventStart.Add("timeZone", "Central Standard Time")

$EventEnd = @{}
$EventEnd.Add("dateTime", "2025-10-01T17:00:00")
$EventEnd.Add("timeZone", "Central Standard Time")

$EventLocation = @{}
$EventLocation.Add("displayName", "Minneapolis")

$Event = @{}
$Event.Add("subject", "The Experts Conference (TEC) 2025")
$Event.Add("body", $EventBody)
$Event.Add("start", $EventStart)
$Event.Add("end", $EventEnd)
$Event.Add("location", $EventLocation)
$Event.Add("allowNewTimeProposals", $true)
$Event.Add("transactionId", (New-Guid))

  1. Create the event (using either cmdlet)

$NewEvent = New-MgUserEvent -UserId $userId -BodyParameter $Event

Event is scheduled. But running the cmdlet at 17:20 on 14 April, the created event started at 17:30 instead of 9AM on September 30. You can see from the debug output that the start and end dates have been changed and the timezone switched from CST to UTC.

Image

SDK Version

2.26.1

Latest version known to work for scenario above?

Unknown

Known Workarounds

Use the Graph API request, which works perfectly.

Debug output

Click to expand log```

DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
POST

Absolute Uri:
https://graph.microsoft.com/v1.0/users/eff4cd58-1bb8-4899-94de-795f656b4a18/events

Headers:
FeatureFlag : 00000003
Cache-Control : no-store, no-cache
User-Agent : Mozilla/5.0,(Windows NT 10.0; Microsoft Windows 10.0.26100; en-IE),PowerShell/7.5.0
SdkVersion : graph-powershell/2.26.1
client-request-id : 669bd0ea-a50c-4bef-b479-6a1195d7b0aa
Accept-Encoding : gzip,deflate,br

Body:
{
"subject": "The Experts Conference (TEC) 2025",
"transactionId": "bf25b696-fc44-4715-9c1d-7e572264d0e5"
}

DEBUG: ============================ HTTP RESPONSE ============================

Status Code:
Created

Headers:
Cache-Control : private
Location : https://graph.microsoft.com/v1.0/users('eff4cd58-1bb8-4899-94de-795f656b4a18')/events('AAMkADAzNzBmMzU0LTI3NTItNDQzNy04NzhkLWNmMGU1MzEwYThkNABGAAAAAAB_7ILpFNx8TrktaK8VYWerBwBe9CuwLc2fTK7W46L1SAp9AAAA2lHQAAA3tTkMTDKYRI6zB9VW59QNAAgkhLM6AAA=')
Strict-Transport-Security : max-age=31536000
request-id : 548845bd-dd7b-4357-9e11-0a9740b43d16
client-request-id : 669bd0ea-a50c-4bef-b479-6a1195d7b0aa
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"North Europe","Slice":"E","Ring":"4","ScaleUnit":"003","RoleInstance":"DB1PEPF0001F9BD"}}
Date : Mon, 14 Apr 2025 16:21:11 GMT

Body:
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('eff4cd58-1bb8-4899-94de-795f656b4a18')/events/$entity",
"@odata.etag": "W/"N7U5DEwymESOswfVVufUDQAIICsq6Q=="",
"id": "AAMkADAzNzBmMzU0LTI3NTItNDQzNy04NzhkLWNmMGU1MzEwYThkNABGAAAAAAB_7ILpFNx8TrktaK8VYWerBwBe9CuwLc2fTK7W46L1SAp9AAAA2lHQAAA3tTkMTDKYRI6zB9VW59QNAAgkhLM6AAA=",
"createdDateTime": "2025-04-14T16:21:11.2569062Z",
"lastModifiedDateTime": "2025-04-14T16:21:11.3283024Z",
"changeKey": "N7U5DEwymESOswfVVufUDQAIICsq6Q==",
"categories": [],
"transactionId": "bf25b696-fc44-4715-9c1d-7e572264d0e5",
"originalStartTimeZone": "UTC",
"originalEndTimeZone": "UTC",
"iCalUId": "040000008200E00074C5B7101A82E00800000000C8DE473C59ADDB01000000000000000010000000111F84A0F73D9947A66167713D47E13D",
"uid": "040000008200E00074C5B7101A82E00800000000C8DE473C59ADDB01000000000000000010000000111F84A0F73D9947A66167713D47E13D",
"reminderMinutesBeforeStart": 15,
"isReminderOn": true,
"hasAttachments": false,
"subject": "The Experts Conference (TEC) 2025",
"bodyPreview": "",
"importance": "normal",
"sensitivity": "normal",
"isAllDay": false,
"isCancelled": false,
"isOrganizer": true,
"responseRequested": true,
"seriesMasterId": null,
"showAs": "busy",
"type": "singleInstance",
"webLink": "https://outlook.office365.com/owa/?itemid=AAMkADAzNzBmMzU0LTI3NTItNDQzNy04NzhkLWNmMGU1MzEwYThkNABGAAAAAAB%2B7ILpFNx8TrktaK8VYWerBwBe9CuwLc2fTK7W46L1SAp9AAAA2lHQAAA3tTkMTDKYRI6zB9VW59QNAAgkhLM6AAA%3D&exvsurl=1&path=/calendar/item",
"onlineMeetingUrl": null,
"isOnlineMeeting": false,
"onlineMeetingProvider": "unknown",
"allowNewTimeProposals": true,
"occurrenceId": null,
"isDraft": false,
"hideAttendees": false,
"responseStatus": {
"response": "organizer",
"time": "0001-01-01T00:00:00Z"
},
"body": {
"contentType": "html",
"content": "<meta http-equiv="Content-Type" content="text/html; charset=utf-8">\r\n<meta name="Generator" content="Microsoft Exchange Server">\r\n\r\n<style></style>\r\n\r\n<font size="2"><span style="font-size:11pt;"><div class="PlainText"> \r\n\r\n\r\n"
},
"start": {
"dateTime": "2025-04-14T16:30:00.0009324",
"timeZone": "UTC"
},
"end": {
"dateTime": "2025-04-14T17:00:00.0009324",
"timeZone": "UTC"
},
"location": {
"displayName": "",
"locationType": "default",
"uniqueIdType": "unknown",
"address": {},
"coordinates": {}
},
"locations": [],
"recurrence": null,
"attendees": [],
"organizer": {
"emailAddress": {
"name": "Tony Redmond",
"address": "[email protected]"
}
},
"onlineMeeting": null
}

DEBUG: [CmdletEndProcessing]: - New-MgUserEvent end processing.

</details>


### Configuration


Name                           Value
----                           -----
PSVersion                      7.5.0
PSEdition                      Core
GitCommitId                    7.5.0
OS                             Microsoft Windows 10.0.26100
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

### Other information

_No response_

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions