Microsoft Graph - Custom attribute - datetime format

juni dev 336 Reputation points
2022-11-06T21:57:28.02+00:00

Hi,

I need to create a custom attribute in MSGraph to store updatedDateTime
I would like to keep it similat to the existing createdDateTime which is like this:"2022-09-08T16:19:53+00:00"

Since my custom attribute updatedDateTime will be computed from Datetime.Now() and it must be a string,
I used DateTime.Now.ToUniversalTime() but It gives the datetime in this different form: "2022-11-06T21:52:39.331382Z"

What format must I force to have it similat to createdDateTime?

Thanks,
JD

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,555 questions
0 comments No comments
{count} votes

Accepted answer
  1. Viorel 112.1K Reputation points
    2022-11-07T10:58:56.177+00:00

    If there is no corresponding standard format, then try a custom one: DateTime.UtcNow.ToString("yyyy'-'MM'-'dd'T'hh':'mm':'sszzz") or DateTime.Now.ToString("yyyy'-'MM'-'dd'T'hh':'mm':'sszzz").


0 additional answers

Sort by: Most helpful