TemporaryAccessPassMethods : Invalid StartDateTime depending on local computer timezone #2724
Labels
status:waiting-for-triage
An issue that is yet to be reviewed or assigned
type:bug
A broken experience
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
The text was updated successfully, but these errors were encountered: