Why does New-MgUserCalendarEvent reject UTC times while Get-MgUserCalendarEvent returns them?

0
7
Asked By CuriousCoder123 On

I'm puzzled by the behavior of the New-MgUserCalendarEvent cmdlet in PowerShell. When I retrieve calendar events using Get-MgUserCalendarEvent, the start and end times are returned in UTC. However, when I try to create a new event with New-MgUserCalendarEvent, it throws an error saying that I must specify a valid TimeZone value. I'm using the exact same start and end times from the Get-MgUserCalendarEvent result, but it still says the TimeZone value is unsupported. Can someone help me understand why this inconsistency exists?

4 Answers

Answered By LogicLover789 On

It looks like the confusion stems from the way UTC is recognized. Although UTC is indeed a timezone, New-MgUserCalendarEvent might require it in a different format like 'UTC+00:00'. Just a thought!

ConfusedCoder -

That makes sense! If that's the case, it’s odd that Get-MgUserCalendarEvent doesn't provide it in that format. I'll check if changing the format helps.

Answered By SolutionSeeker On

I found a workaround! Converting the times returned from Get-MgUserCalendarEvent to my local timezone before passing them into New-MgUserCalendarEvent has worked well. While it’s annoying that I can’t use the exact times, at least there's a solution.

Answered By TimezoneTroubles On

Honestly, this kind of inconsistency is just annoying. UTC should be accepted since that's what is returned. It feels like there's a disconnect in the cmdlets' design.

Answered By SkepticalSimon On

It sounds frustrating! The error message indicates that the timezone is being interpreted as empty (''). While you expect UTC to be a valid timezone, it seems New-MgUserCalendarEvent might require a specific formatting or identifier for that timezone. It's a common hiccup when dealing with APIs.

HelpfulHannah -

I definitely get it! Have you tried specifying the timezone explicitly when calling New-MgUserCalendarEvent? Sometimes the cmdlet needs a full string like 'UTC' instead of just relying on the object you received.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.