Skip to content

Microsoft.Graph 5.75.0 graphServiceClient.Users[userId].Calendar.Events[recurringEventId].Instances.GetAsync() throwing Content type text/html does not have a factory registered to be parsed #3009

@mghabin

Description

@mghabin

Hello,

Details:

  • Multiple tenants affected.
  • Multiple users affected.
  • Microsoft.Graph 5.75.0
  • Method used: graphServiceClient.Users[userId].Calendar.Events[recurringEventId].Instances.GetAsync()
  • Calls made using App permissions (The tenants admins consented, and service principle is living in the customer tenant with right permissions)
  • Issue started to happen in last month and we don't want this to grow.

Code used:

private readonly string defaultExpandExtendedProperties = $"singleValueExtendedProperties($filter=" +
     $"id eq '{ExtendedPropertyIds.A}'" +
     $"or id eq '{ExtendedPropertyIds.B}'" +
     $")";
var eventOccurrencesFilterParts = new List<string>
{
    $"singleValueExtendedProperties/Any(p: p/id eq '{ExtendedPropertyIds.A}' and p/value eq '{AValue}') " +
    $"or singleValueExtendedProperties/Any(p: p/id eq '{ExtendedPropertyIds.B}' and p/value eq '{BValue}')",
};

var occurrences = await graphServiceClient
    .Users[userId]
    .Calendar
    .Events[recurringEventId]
    .Instances
    .GetAsync(requestConfiguration =>
    {
        requestConfiguration.Headers.Add("Prefer", $"outlook.timezone=\"{timezone}\"");
        requestConfiguration.QueryParameters.Expand = [this.defaultExpandExtendedProperties];
        requestConfiguration.QueryParameters.StartDateTime = startUtc;
        requestConfiguration.QueryParameters.EndDateTime = endUtc;
        requestConfiguration.QueryParameters.Top = 50;
        requestConfiguration.QueryParameters.Filter = string.Join(" and ", eventOccurrencesFilterParts);
        requestConfiguration.QueryParameters.Select =
        [
            "id", "subject", "body", "bodyPreview", "start", "end", "organizer", "attendees",
            "singleValueExtendedProperties", "onlineMeeting", "originalStartTimeZone", "seriesMasterId", "type"
        ];
    });

Results in:

System.InvalidOperationException: Content type text/html does not have a factory registered to be parsed    at Microsoft.Kiota.Abstractions.Serialization.ParseNodeFactoryRegistry.GetRootParseNodeAsync(String contentType, Stream content, CancellationToken cancellationToken)    at Microsoft.Kiota.Abstractions.Serialization.ParseNodeProxyFactory.GetRootParseNodeAsync(String contentType, Stream content, CancellationToken cancellationToken)    at Microsoft.Kiota.Http.HttpClientLibrary.HttpClientRequestAdapter.GetRootParseNodeAsync(HttpResponseMessage response, CancellationToken cancellationToken)    at Microsoft.Kiota.Http.HttpClientLibrary.HttpClientRequestAdapter.ThrowIfFailedResponseAsync(HttpResponseMessage response, Dictionary`2 errorMapping, Activity activityForAttributes, CancellationToken cancellationToken)    at Microsoft.Kiota.Http.HttpClientLibrary.HttpClientRequestAdapter.SendAsync[ModelType](RequestInformation requestInfo, ParsableFactory`1 factory, Dictionary`2 errorMapping, CancellationToken cancellationToken)    at Microsoft.Kiota.Http.HttpClientLibrary.HttpClientRequestAdapter.SendAsync[ModelType](RequestInformation requestInfo, ParsableFactory`1 factory, Dictionary`2 errorMapping, CancellationToken cancellationToken)    at Microsoft.Graph.Users.Item.Calendar.Events.Item.Instances.InstancesRequestBuilder.GetAsync(Action`1 requestConfiguration, CancellationToken cancellationToken)    at **Reducted**

Please help us solving this as customers panics from this to grow.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions