msgraph-sdk-dotnet icon indicating copy to clipboard operation
msgraph-sdk-dotnet copied to clipboard

Pagination stopped working for multiple Graph resources

Open Semptra opened this issue 6 days ago • 6 comments

Describe the bug

Pagination stopped working correctly for multiple Microsoft Graph API resources since 2024-06-29. In particular, this includes the following endpoints (but potentially could affect more, those are the ones we are using and noticed the problem for):

When using those endpoints with $top OData query parameter and following the @odata.nextLink, I'm getting the following error:

The query specified in the URI is not valid. Query option 'SkipToken' is not allowed. To allow it, set the 'AllowedQueryOptions' property on EnableQueryAttribute or QueryValidationSettings.

Before the 2024-06-29, both endpoints worked correctly with $top OData query parameter.

Note: this issue is most likely not an SDK problem, but rather an issue in Microsoft Graph API. I can reproduce this issue in Microsoft Graph Explorer:

image

After clicking the link:

image

Expected behavior

Code executes without errors.

How to reproduce

var graphServiceClient = new GraphServiceClient(credentials);

var response = await graphServiceClient.Security.SecureScoreControlProfiles.GetAsync(requestConfiguration =>
{
    requestConfiguration.QueryParameters.Top = 1;
});

var profiles = new List<SecureScoreControlProfile>();

var pageIterator = PageIterator<SecureScoreControlProfile, SecureScoreControlProfileCollectionResponse>
    .CreatePageIterator(graphServiceClient, response, (profile) =>
    {
        profiles.Add(profile);

        return true;
    });

await pageIterator.IterateAsync();

SDK Version

5.36.0

Latest version known to work for scenario above?

No response

Known Workarounds

No response

Debug output

Click to expand log ``` { "error": { "code": "", "message": "The query specified in the URI is not valid. Query option 'SkipToken' is not allowed. To allow it, set the 'AllowedQueryOptions' property on EnableQueryAttribute or QueryValidationSettings.", "innerError": { "message": "Query option 'SkipToken' is not allowed. To allow it, set the 'AllowedQueryOptions' property on EnableQueryAttribute or QueryValidationSettings.", "date": "2024-07-01T09:02:07", "request-id": "b5cd51b7-3c92-4324-9986-0158046877c9", "client-request-id": "6997a046-9624-4df8-4ecf-334c74e86679" } } } ```

Configuration

No response

Other information

No response

Semptra avatar Jul 01 '24 09:07 Semptra