I have a working version of application which uses Microsoft.Graph API version 4.37. Now upgrading it to use latest version 5.*.
Batch requests return a single item's response in JSON like (trimmed here):
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('fb5b52e2-ce57-4273-875c-570a71c1c0d9')/events/$entity",
"@odata.etag": "W/\"mv/EZgBe4U+n/DGkFJWGXQAJc2FSXg==\"",
"id": "id value here",
"createdDateTime": "2014-01-06T09:04:30.4737618Z",
"lastModifiedDateTime": "2023-05-24T10:37:13.3823665Z",
"originalStartTimeZone": "UTC",
"......................................................................................
"hasAttachments": false,
"subject": "Dad's Birthday",
"importance": "normal",
"sensitivity": "normal",
........................................................
"body": {
"contentType": "html",
"content": "......"
},
"start": {
"dateTime": "1991-05-24T00:00:00.0000000",
"timeZone": "UTC"
},
"end": {
"dateTime": "1991-05-25T00:00:00.0000000",
"timeZone": "UTC"
},
.................................................
}
In order to deserialize it I'm using such code:
var options = new JsonSerializerOptions() { PropertyNameCaseInsensitive = true };
options.Converters.Add(new JsonStringEnumConverter());
var event = System.Text.Json.JsonSerializer.Deserialize<Event>(text, options);
Case insensityvity option and Enum converter solves the case when only boolean, string, DateTime and now ENUM type properties are SELECT'ed for retrieve.
But if "recurrence" property is included in SELECT, deserializer fails throwing "The JSON value could not be converted to Microsoft.Kiota.Abstractions.Date. Path: $.recurrence.range.startDate ....".
..........................
"recurrence": {
"pattern": {
"type": "absoluteYearly",
"interval": 1,
"month": 5,
"dayOfMonth": 24,
"firstDayOfWeek": "sunday",
"index": "first"
},
"range": {
"type": "noEnd",
"startDate": "1991-05-24",
"endDate": "0001-01-01",
"recurrenceTimeZone": "FLE Standard Time",
"numberOfOccurrences": 0
}
},
......................
Is there a converter for Microsoft.Kiota.Abstractions.Date anywhere? Should I create it myself or there is a list of already generated popular ones (like JsonStringEnumConverter) somewhere and can't find them?
"recurrence" property is the ONLY failing now...