Closed SirRichie closed 3 years ago
@SirRichie Thanks for raising this issue. Coudl you provide what version of the sdk are you using?
Hi, sorry I forgot to mention that. Version is 4.0.0-preview
Any chance you could try the latest update? That is 4.0.1-preview.
This seems to work. Sorry for the confusion I thought I tested with the latest version but I guess I did not.
No worries about that. Thanks for trying out the new preview!
When trying to use the Graph API to upload a UserPfxCertificate the SDK provides the type UserPfxCertificate.
Its date-related properties are of type DateTimeOffset. However, when using above endpoint, the seralized date properties are not adhering to Edm.DateTimeOffset
This results in the Graph endpoint to return with an error, e.g.:
Cannot convert the literal '14.04.2021 14:11:27 +02:00' to the expected type 'Edm.DateTimeOffset'.
After some investigation and directly querying the underlying seralizer, I noticed that the format is correct for DateTime, but not for DateTimeOffset:
var request = graphService.DeviceManagement.UserPfxCertificates.Request();
Console.WriteLine(request.Client.HttpProvider.Serializer.SerializeObject(DateTime.Now));
// results in "\"2021-04-14T14:12:31.6191591+02:00\""
Console.WriteLine(request.Client.HttpProvider.Serializer.SerializeObject(new DateTimeOffset()));
// "\"01.01.0001 00:00:00 \\u002B00:00\""
The latter is incorrect and leads to the specified error.
AB#8984