Skip to content
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

TemporaryAccessPassMethods : Invalid StartDateTime depending on local computer timezone #2724

Open
rogaxentys opened this issue Oct 24, 2024 · 1 comment
Labels
status:waiting-for-triage An issue that is yet to be reviewed or assigned type:bug A broken experience

Comments

@rogaxentys
Copy link

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_
@rogaxentys rogaxentys added status:waiting-for-triage An issue that is yet to be reviewed or assigned type:bug A broken experience labels Oct 24, 2024
@masonwolff
Copy link

This is still an issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:waiting-for-triage An issue that is yet to be reviewed or assigned type:bug A broken experience
Projects
None yet
Development

No branches or pull requests

2 participants