Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
12Knocksinna opened this issue Apr 14, 2025 · 18 comments

Comments

@12Knocksinna
Copy link

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_
@12Knocksinna 12Knocksinna added status:waiting-for-triage An issue that is yet to be reviewed or assigned type:bug A broken experience labels Apr 14, 2025
@timayabi2020
Copy link
Contributor

timayabi2020 commented Apr 15, 2025

Hi @12Knocksinna the fix for this issue is on the next release that is still currently on testing. The ETA is by end of next week. However, in case of anything blocking the release, we shall communicate.

Image Image

@timayabi2020
Copy link
Contributor

@12Knocksinna please confirm with the latest version 2.27.0

@timayabi2020 timayabi2020 added the status:waiting-for-author-feedback Issue that we've responded but needs author feedback to close label Apr 21, 2025
@12Knocksinna
Copy link
Author

@timayabi2020 Sorry. Still not working. Event is created in next 30 minute slot. Even worse than before, most of the event detail is missing in the entry posted to the calendar.

Here's what is posted:

AllowNewTimeProposals : True
Attachments :
Attendees : {}
Body : Microsoft.Graph.PowerShell.Models.MicrosoftGraphItemBody
BodyPreview :
Calendar : Microsoft.Graph.PowerShell.Models.MicrosoftGraphCalendar
Categories : {}
ChangeKey : dCe5Ja94hEezlaCl2OOETAABlVamhQ==
CreatedDateTime : 21/04/2025 09:16:46
End : Microsoft.Graph.PowerShell.Models.MicrosoftGraphDateTimeZone
Extensions :
HasAttachments : False
HideAttendees : False
ICalUId : 040000008200E00074C5B7101A82E008000000005FF1FC1A9EB2DB01000000000000000010000000BE1F901
065D4A3468B265F050832E904
Id : AAMkADJjNjgyOWU3LWU2OWQtNDE0ZC05NjY1LTViYWQ0N2M2Njk5MgBGAAAAAAAV54tB4i0xTJG3aFRwwIn0BwB
0J7klr3iER7OVoKXY44RMAAAAAAENAAB0J7klr3iER7OVoKXY44RMAAGVU--eAAA=
Importance : normal
Instances :
IsAllDay : False
IsCancelled : False
IsDraft : False
IsOnlineMeeting : False
IsOrganizer : True
IsReminderOn : True
LastModifiedDateTime : 21/04/2025 09:16:46
Location : Microsoft.Graph.PowerShell.Models.MicrosoftGraphLocation
Locations : {}
MultiValueExtendedProperties :
OnlineMeeting : Microsoft.Graph.PowerShell.Models.MicrosoftGraphOnlineMeetingInfo
OnlineMeetingProvider : unknown
OnlineMeetingUrl :
Organizer : Microsoft.Graph.PowerShell.Models.MicrosoftGraphRecipient
OriginalEndTimeZone : UTC
OriginalStart :
OriginalStartTimeZone : UTC
Recurrence : Microsoft.Graph.PowerShell.Models.MicrosoftGraphPatternedRecurrence
ReminderMinutesBeforeStart : 15
ResponseRequested : True
ResponseStatus : Microsoft.Graph.PowerShell.Models.MicrosoftGraphResponseStatus
Sensitivity : normal
SeriesMasterId :
ShowAs : busy
SingleValueExtendedProperties :
Start : Microsoft.Graph.PowerShell.Models.MicrosoftGraphDateTimeZone
Subject :
TransactionId :
Type : singleInstance
WebLink : https://outlook.office365.com/owa/?itemid=AAMkADJjNjgyOWU3LWU2OWQtNDE0ZC05NjY1LTViYWQ0N
2M2Njk5MgBGAAAAAAAV54tB4i0xTJG3aFRwwIn0BwB0J7klr3iER7OVoKXY44RMAAAAAAENAAB0J7klr3iER7OV
oKXY44RMAAGVU%2F%2FeAAA%3D&exvsurl=1&path=/calendar/item
AdditionalProperties : {[@odata.context, https://graph.microsoft.com/v1.0/$metadata#users('21a3ce8f-6d55-4e57-
9210-d85a2f1618ec')/events/$entity], [@odata.etag,
W/"dCe5Ja94hEezlaCl2OOETAABlVamhQ=="], [uid, 040000008200E00074C5B7101A82E008000000005F
F1FC1A9EB2DB01000000000000000010000000BE1F901065D4A3468B265F050832E904]}

And here's what Debug says. It looks like many properties are dropped...

Absolute Uri:
https://graph.microsoft.com/v1.0/users/21a3ce8f-6d55-4e57-9210-d85a2f1618ec/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.27.0
client-request-id : 64885d2b-9902-4f4e-a6c1-c420c33a678b
Accept-Encoding : gzip,deflate,br

Body:
{
"allowNewTimeProposals": true
}

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

Status Code:
Created

Headers:
Cache-Control : private
Location : https://graph.microsoft.com/v1.0/users('21a3ce8f-6d55-4e57-9210-d85a2f1618ec')/events('AAMkADJjNjgyOWU3LWU2OWQtNDE0ZC05NjY1LTViYWQ0N2M2Njk5MgBGAAAAAAAV54tB4i0xTJG3aFRwwIn0BwB0J7klr3iER7OVoKXY44RMAAAAAAENAAB0J7klr3iER7OVoKXY44RMAAGVU--hAAA=')
Strict-Transport-Security : max-age=31536000
request-id : 990c9b9e-d157-4204-b946-7c78092c9c19
client-request-id : 64885d2b-9902-4f4e-a6c1-c420c33a678b
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"North Europe","Slice":"E","Ring":"4","ScaleUnit":"008","RoleInstance":"DU2PEPF000364A4"}}
Date : Mon, 21 Apr 2025 09:22:11 GMT

Body:
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('21a3ce8f-6d55-4e57-9210-d85a2f1618ec')/events/$entity",
"@odata.etag": "W/"dCe5Ja94hEezlaCl2OOETAABlVammg=="",
"id": "AAMkADJjNjgyOWU3LWU2OWQtNDE0ZC05NjY1LTViYWQ0N2M2Njk5MgBGAAAAAAAV54tB4i0xTJG3aFRwwIn0BwB0J7klr3iER7OVoKXY44RMAAAAAAENAAB0J7klr3iER7OVoKXY44RMAAGVU--hAAA=",
"createdDateTime": "2025-04-21T09:22:11.7293634Z",
"lastModifiedDateTime": "2025-04-21T09:22:11.7942124Z",
"changeKey": "dCe5Ja94hEezlaCl2OOETAABlVammg==",
"categories": [],
"transactionId": null,
"originalStartTimeZone": "UTC",
"originalEndTimeZone": "UTC",
"iCalUId": "040000008200E00074C5B7101A82E00800000000F0A0D8DC9EB2DB01000000000000000010000000F09A0A740844464585CB62439469958A",
"uid": "040000008200E00074C5B7101A82E00800000000F0A0D8DC9EB2DB01000000000000000010000000F09A0A740844464585CB62439469958A",
"reminderMinutesBeforeStart": 15,
"isReminderOn": true,
"hasAttachments": false,
"subject": null,
"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=AAMkADJjNjgyOWU3LWU2OWQtNDE0ZC05NjY1LTViYWQ0N2M2Njk5MgBGAAAAAAAV54tB4i0xTJG3aFRwwIn0BwB0J7klr3iER7OVoKXY44RMAAAAAAENAAB0J7klr3iER7OVoKXY44RMAAGVU%2F%2FhAAA%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-21T09:30:00.0003056",
"timeZone": "UTC"
},
"end": {
"dateTime": "2025-04-21T10:00:00.0003056",
"timeZone": "UTC"
},
"location": {
"displayName": "",
"locationType": "default",
"uniqueIdType": "unknown",
"address": {},
"coordinates": {}
},
"locations": [],
"recurrence": null,
"attendees": [],
"organizer": {
"emailAddress": {
"name": ""Popeye" Doyle",
"address": "[email protected]"
}
},
"onlineMeeting": null
}

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

@microsoft-github-policy-service microsoft-github-policy-service bot added Needs: Attention 👋 and removed status:waiting-for-author-feedback Issue that we've responded but needs author feedback to close labels Apr 21, 2025
@12Knocksinna
Copy link
Author

get-module

ModuleType Version PreRelease Name ExportedCommands


Script 2.27.0 Microsoft.Graph.Authentication {Add-MgEnvironment, Connect-MgGraph, Disconnect-M…
Script 2.27.0 Microsoft.Graph.Calendar {Get-MgGroupCalendar, Get-MgGroupCalendarEvent, G…
Script 2.27.0 Microsoft.Graph.Users {Get-MgUser, Get-MgUserByUserPrincipalName, Get-M…
Manifest 7.0.0.0 Microsoft.PowerShell.Management {Add-Content, Clear-Content, Clear-Item, Clear-It…
Manifest 7.0.0.0 Microsoft.PowerShell.Utility {Add-Member, Add-Type, Clear-Variable, Compare-Ob…
Script 1.4.8.1 PackageManagement {Find-Package, Find-PackageProvider, Get-Package,…
Script 2.2.5 PowerShellGet {Find-Command, Find-DscResource, Find-Module, Fin…
Script 2.3.6 PSReadLine {Get-PSReadLineKeyHandler, Get-PSReadLineOptio

@timayabi2020
Copy link
Contributor

@12Knocksinna I also got the same error on first time installation and immediately started using it. However, after restarting the PowerShell session I was able to get the correct payload. Please restart the session and let me know if you are still experiencing the same.

@timayabi2020 timayabi2020 added status:waiting-for-author-feedback Issue that we've responded but needs author feedback to close and removed Needs: Attention 👋 labels Apr 22, 2025
@12Knocksinna
Copy link
Author

I exited PowerShell, restarted a session, connected to Graph in app-only mode (make sure of permissions) and reran the script. New-MgUserEvent created an empty event, the Graph request created the expected event. Both used the same payload.

@microsoft-github-policy-service microsoft-github-policy-service bot added Needs: Attention 👋 and removed status:waiting-for-author-feedback Issue that we've responded but needs author feedback to close labels Apr 22, 2025
@12Knocksinna
Copy link
Author

There are other issues with the calendar events cmdlets. The Update-MgUserEvent cmdlet doesn't seem to work when adding attendees and I cannot get the New-MgUserEventAttachment cmdlet to work despite using the exact example cited in the documentation https://learn.microsoft.com/en-us/graph/api/event-post-attachments?view=graph-rest-1.0&tabs=powershell, Maybe the whole area of calendar events cmdlets need some TLC?

@timayabi2020
Copy link
Contributor

With Update-MgUserEvent I am able to add attendees.
Image

Image

The attachment one gave me a service error.

Image

@timayabi2020 timayabi2020 added status:waiting-for-author-feedback Issue that we've responded but needs author feedback to close and removed Needs: Attention 👋 labels Apr 22, 2025
@12Knocksinna
Copy link
Author

I see different behavior with the Graph request and the cmdlet. The graph request works with this payload containing 3 attendees:

$EventDetails = @{}

array with details of event participants

$ParticipantsArray = @(
@{ name = "Kim Akers"; emailaddress = "[email protected]"; state = "required" },
@{ name = "Lotte Vetler"; emailaddress = "[email protected]"; state = "optional" },
@{ name = "Otto Flick"; emailaddress = "[email protected]"; state = "required" }
)

Create hash tables for each participant

$EventAttendees = @()
foreach ($Participant in $ParticipantsArray) {
$ParticipantHash = @{
address = $Participant.emailaddress
name = $Participant.name
}

$EventAttendee = @{
    emailaddress = $ParticipantHash
    type         = $Participant.state
}

$EventAttendees += $EventAttendee

}

Add the attendees to the event

$EventDetails.Add("attendees", $EventAttendees)

$Uri = ("https://graph.microsoft.com/v1.0/users/{0}/events/{1}" -f $UserId, $NewEvent.Id)
$UpdatedEvent = Invoke-MgGraphRequest -Uri $Uri -Method PATCH -Body $EventDetails

Using the same payload, Update-MgUserEvent doesn't update the attendees.

$EventDetails

Name Value


attendees {System.Collections.Hashtable, System.Collections.Hashtable, System.Collections.Hashtab…

Update-MgUserEvent -UserId $UserId -EventId $NewEvent.Id -BodyParameter $EventDetails -debug
DEBUG: [CmdletBeginProcessing]: - Update-MgUserEvent begin processing with parameterSet 'Update'.
DEBUG: [Authentication]: - AuthType: 'AppOnly', TokenCredentialType: 'ClientCertificate', ContextScope: 'Process', AppName: 'CalendarEvents'.
DEBUG: [Authentication]: - Scopes: [User.ReadBasic.All, Calendars.ReadWrite].

Confirm
Are you sure you want to perform this action?
Performing the operation "Update-MgUserEvent_Update" on target "Call remote 'PATCH /users/{user-id}/events/{event-id}'
operation".
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): y
DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
PATCH

Absolute Uri:
https://graph.microsoft.com/v1.0/users/21a3ce8f-6d55-4e57-9210-d85a2f1618ec/events/AAMkADJjNjgyOWU3LWU2OWQtNDE0ZC05NjY1LTViYWQ0N2M2Njk5MgBGAAAAAAAV54tB4i0xTJG3aFRwwIn0BwB0J7klr3iER7OVoKXY44RMAAAAAAENAAB0J7klr3iER7OVoKXY44RMAAGVU--pAAA%3D

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.27.0
client-request-id : d75c1fcc-bc53-4c37-955e-cacf45fb2f43
Accept-Encoding : gzip,deflate,br

Body:
{}

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

Status Code:
OK

Headers:
Cache-Control : private
Strict-Transport-Security : max-age=31536000
request-id : 05c5a976-5db7-4d9e-b535-4e5f327d983b
client-request-id : d75c1fcc-bc53-4c37-955e-cacf45fb2f43
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"North Europe","Slice":"E","Ring":"4","ScaleUnit":"001","RoleInstance":"DU2PEPF000107E7"}}
Date : Tue, 22 Apr 2025 12:27:27 GMT

Body:
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('21a3ce8f-6d55-4e57-9210-d85a2f1618ec')/events/$entity",
"@odata.etag": "W/"dCe5Ja94hEezlaCl2OOETAABlVb2ww=="",
"id": "AAMkADJjNjgyOWU3LWU2OWQtNDE0ZC05NjY1LTViYWQ0N2M2Njk5MgBGAAAAAAAV54tB4i0xTJG3aFRwwIn0BwB0J7klr3iER7OVoKXY44RMAAAAAAENAAB0J7klr3iER7OVoKXY44RMAAGVU--pAAA=",
"createdDateTime": "2025-04-22T12:26:24.7380461Z",
"lastModifiedDateTime": "2025-04-22T12:27:27.3676947Z",
"changeKey": "dCe5Ja94hEezlaCl2OOETAABlVb2ww==",
"categories": [
"Conference",
"Travel"
],
"transactionId": "b8facae6-3d02-425a-9a54-6c9a4bd910fc",
"originalStartTimeZone": "Central Standard Time",
"originalEndTimeZone": "Central Standard Time",
"iCalUId": "040000008200E00074C5B7101A82E008000000004DAD5DC381B3DB01000000000000000010000000E468D23950AEE649BDBF137C203D8B9A",
"uid": "040000008200E00074C5B7101A82E008000000004DAD5DC381B3DB01000000000000000010000000E468D23950AEE649BDBF137C203D8B9A",
"reminderMinutesBeforeStart": 15,
"isReminderOn": true,
"hasAttachments": false,
"subject": "The Experts Conference (TEC) 2025 – Best Conference Ever",
"bodyPreview": "The TEC 2025 comference event starts with registration and breakfast at 8:30AM. The first session will commence at 9:30AM",
"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=AAMkADJjNjgyOWU3LWU2OWQtNDE0ZC05NjY1LTViYWQ0N2M2Njk5MgBGAAAAAAAV54tB4i0xTJG3aFRwwIn0BwB0J7klr3iER7OVoKXY44RMAAAAAAENAAB0J7klr3iER7OVoKXY44RMAAGVU%2F%2FpAAA%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": "\r\n\r\n<meta http-equiv="Content-Type" content="text/html; charset=utf-8">\r\n\r\n\r\nThe TEC 2025 comference event starts with registration and breakfast at 8:30AM. The first session will commence at 9:30AM\r\n\r\n\r\n"
},
"start": {
"dateTime": "2025-09-30T14:00:00",
"timeZone": "UTC"
},
"end": {
"dateTime": "2025-10-01T22:00:00",
"timeZone": "UTC"
},
"location": {
"displayName": "Minneapolis",
"locationType": "default",
"uniqueId": "Minneapolis",
"uniqueIdType": "private"
},
"locations": [
{
"displayName": "Minneapolis",
"locationType": "default",
"uniqueId": "Minneapolis",
"uniqueIdType": "private"
}
],
"recurrence": null,
"attendees": [],
"organizer": {
"emailAddress": {
"name": ""Popeye" Doyle",
"address": "[email protected]"
}
},
"onlineMeeting": null
}

DEBUG: [CmdletEndProcessing]: - Update-MgUserEvent end processing.
Subject Id


The Experts Conference (TEC) 2025 – Best Conference Ever AAMkADJjNjgyOWU3LWU2OWQtNDE0ZC05NjY1LTViYWQ0N2M2Njk5MgBGAAAAA…#

It seems like the attendees information is simply ignored.

What kind of payload did you use to update the attendees?

@microsoft-github-policy-service microsoft-github-policy-service bot added Needs: Attention 👋 and removed status:waiting-for-author-feedback Issue that we've responded but needs author feedback to close labels Apr 22, 2025
@timayabi2020
Copy link
Contributor

This is the payload I used

$attendee1 = [Microsoft.Graph.PowerShell.Models.MicrosoftGraphAttendee]::new()
$attendee1.Type = "Required"
$attendee1.EmailAddress = [Microsoft.Graph.PowerShell.Models.MicrosoftGraphEmailAddress]::new()
$attendee1.EmailAddress.Address = "[email protected]"
$attendee1.EmailAddress.Name = "Person One"

but let me try adding three at a go and see

@12Knocksinna
Copy link
Author

Your payload didn't work for me...

$MyAttendee = [Microsoft.Graph.PowerShell.Models.MicrosoftGraphAttendee]::new()
$MyAttendee.Type = "Required"
$Myattendee.EmailAddress = [Microsoft.Graph.PowerShell.Models.MicrosoftGraphEmailAddress]::new()
$Myattendee.EmailAddress.Address = "[email protected]"
$Myattendee.EmailAddress.Name = "Adele Vance"

Update-MgUserEvent -UserId $UserId -EventId $NewEvent.Id -BodyParameter $MyAttendee -debug

Body:
{
"error": {
"code": "RequestBodyRead",
"message": "The property 'emailAddress' does not exist on type 'microsoft.graph.event'. Make sure to only use property names that are defined by the type or mark the type as open type."
}
}

Looks like the cmdlet is a little flaky... Or I am a little flaky

@12Knocksinna
Copy link
Author

Doesn't work with pdate-MgUserEvent -UserId $UserId -EventId $NewEvent.Id -Attendees $MyAttendee either...

But no error.

@timayabi2020
Copy link
Contributor

It worked but just to be sure I'm not running into any conflicts, I imported the calendars module first
Image

Image

@12Knocksinna
Copy link
Author

The calendar module is loaded... I don't think it's that. Maybe I shall try a reboot, just to see.

@12Knocksinna
Copy link
Author

After rebooting the PC, this worked:

Update-MgUserEvent -UserId $UserId -EventId $NewEvent.Id -Attendees $MyAttendee

The way I read the documentation is that an array of attendees is passed in a hash table when multiple attendees are involved. So I tried with:

$MyAttendee = [Microsoft.Graph.PowerShell.Models.MicrosoftGraphAttendee]::new()
$MyAttendee.Type = "Required"
$Myattendee.EmailAddress = [Microsoft.Graph.PowerShell.Models.MicrosoftGraphEmailAddress]::new()
$Myattendee.EmailAddress.Address = "[email protected]"
$Myattendee.EmailAddress.Name = "Adele Vance"

$MyAttendee1 = [Microsoft.Graph.PowerShell.Models.MicrosoftGraphAttendee]::new()
$MyAttendee1.Type = "Optional"
$Myattendee1.EmailAddress = [Microsoft.Graph.PowerShell.Models.MicrosoftGraphEmailAddress]::new()
$Myattendee1.EmailAddress.Address = "[email protected]"
$Myattendee1.EmailAddress.Name = "Sean Landy"

$MyAttendee2 = [Microsoft.Graph.PowerShell.Models.MicrosoftGraphAttendee]::new()
$MyAttendee2.Type = "Required"
$Myattendee2.EmailAddress = [Microsoft.Graph.PowerShell.Models.MicrosoftGraphEmailAddress]::new()
$Myattendee2.EmailAddress.Address = "[email protected]"
$Myattendee2.EmailAddress.Name = "Rene.Artois"

[array]$EventAttendees = $MyAttendee, $MyAttendee1, $MyAttendee2

Update-MgUserEvent -UserId $UserId -EventId $NewEvent.Id -Attendees $EventAttendees

And that worked...

Weird that the reboot seemed to have cured the problem.

@12Knocksinna
Copy link
Author

Using the same array with the Graph request doesn't work.

$Ev = @{}
$ev.Add("attendees", $EventAttendees)
Invoke-MgGraphRequest -Uri $Uri -Method PATCH -Body $ev
Invoke-MgGraphRequest: PATCH https://graph.microsoft.com/v1.0/users/21a3ce8f-6d55-4e57-9210-d85a2f1618ec/events/AAMkADJjNjgyOWU3LWU2OWQtNDE0ZC05NjY1LTViYWQ0N2M2Njk5MgBGAAAAAAAV54tB4i0xTJG3aFRwwIn0BwB0J7klr3iER7OVoKXY44RMAAAAAAENAAB0J7klr3iER7OVoKXY44RMAAGVU--rAAA=
HTTP/2.0 400 Bad Request
Cache-Control: private
Strict-Transport-Security: max-age=31536000
request-id: a9df5008-c9e6-47a8-a275-d74348fb6193
client-request-id: 139711ec-f62c-4d00-af5f-73eb7955fbbe
x-ms-ags-diagnostic: {"ServerInfo":{"DataCenter":"North Europe","Slice":"E","Ring":"4","ScaleUnit":"009","RoleInstance":"DU2PEPF00026068"}}
Date: Tue, 22 Apr 2025 13:52:52 GMT
Content-Type: application/json; odata.metadata=minimal; odata.streaming=true; IEEE754Compatible=false; charset=utf-8

{"error":{"code":"RequestBodyRead","message":"A null value was found for the property named 'dateTime', which has the expected type 'microsoft.graph.dateTime[Nullable=False]'. The expected type 'microsoft.graph.dateTime[Nullable=False]' does not allow null values."}}

Looks like it's missing a property that needs to be added when you declare the attendee to be of Microsoft.Graph.PowerShell.Models.MicrosoftGraphAttendee. Maybe it's looking for a value for proposedNewTime, but that doesn't seem to be necessary.

@timayabi2020
Copy link
Contributor

Yep. Its looking for that and it seems the api requires it whether its null or not.

Image

@timayabi2020 timayabi2020 added status:waiting-for-author-feedback Issue that we've responded but needs author feedback to close and removed Needs: Attention 👋 labels Apr 22, 2025
@12Knocksinna
Copy link
Author

So there's some work to be done to make everything function consistently across the Graph request and cmdlet.

And you couldn't add an attachment to an event either... that's interesting.

@microsoft-github-policy-service microsoft-github-policy-service bot added Needs: Attention 👋 and removed status:waiting-for-author-feedback Issue that we've responded but needs author feedback to close labels Apr 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants