TemporaryAccessPassMethods : Invalid StartDateTime depending on local computer timezone
Describe the bug
I'm trying to create a temporary access pass (TAP) for a user and specify the start date time of the TAP but I get the following error message : "One or more errors occurred. (Invalid StartDateTime specified. It can not be a time in the past.)"
My local time zone is UTC +1 (Brussels). If I add an offset of 7 hours (less doesn't work), the TAP is created successfully but the activation date is 7 hours from now. If I set my local computer time zone to something else without an offset, I have the same error message. If I set my local computer time zone to UTC -6 and add an offset of 7 hours, the TAP is created and the activation date is now correct. If I manually specify the time to be "Now + 5 minutes", I have the same error message. If I manually specify the time to be "Now + 7 hours", it works but with activation date in 7 hours.
Expected behavior
A temporary access pass should be created for the user with an activation time/date matching the specified DateTimeOffset.
How to reproduce
DateTimeOffset startDateTime = DateTimeOffset.Now; var requestBody = new TemporaryAccessPassAuthenticationMethod { StartDateTime = startDateTime, LifetimeInMinutes = 60, IsUsableOnce = false, };
using (var task = Task.Run(async () => await graphClient.Users[currentUserID] .Authentication .TemporaryAccessPassMethods.PostAsync(requestBody))) { while (!task.IsCompleted) Thread.Sleep(200); if (task.IsFaulted) { return task.Exception.Message; } return task.Result.TemporaryAccessPass;
SDK Version
5.59.0
Latest version known to work for scenario above?
No response
Known Workarounds
Set your local computer's time zone to [Your time zone -6] and add an offset of +7 hours.
Debug output
Click to expand log
```Exception thrown: 'Microsoft.Graph.Models.ODataErrors.ODataError' in System.Private.CoreLib.dll
</details>
### Configuration
Windows 11, x64
### Other information
_No response_
This is still an issue
have the same issue.
We're also seeing the same issue. FWIW, we don't see this issue when using Graph Explorer (HTTP) or PowerShell. Only when using C# (haven't tried the other Request methods).