microsoftgraph / microsoftgraph/msgraph-sdk-php

The `top` and `filter` query parameters do not work together

Open
#1,485 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
669
Forks
150
Avg merge
15h 21m
Merged PRs (30d)
3

Description

When the filter and top query parameters are both set, the top parameter appears to be ignored. The following script echoes 1000 . This appears to be the maximum allowed page size.
When the filter parameter is removed, the script echoes 10 - as expected.

use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Users\UsersRequestBuilderGetRequestConfiguration;

$tokenRequestContext = new ClientCredentialContext(
   'tenant_id',
   'client_id',
   'client_secret' 
);

$graphServiceClient = new GraphServiceClient($tokenRequestContext);

$queryParameters = UsersRequestBuilderGetRequestConfiguration::createQueryParameters();
$queryParameters->filter = "signInActivity/lastSignInDateTime ge 2024-01-01T00:00:00Z";
$queryParameters->top = 10;

$requestConfiguration = new UsersRequestBuilderGetRequestConfiguration();
$requestConfiguration->queryParameters = $queryParameters;

$result = $graphServiceClient->users()->get($requestConfiguration)->wait();
echo count($result->getValue());

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the script with UsersRequestBuilderGetRequestConfiguration, comparing the generated request when filter and top are used together with the request using top alone. Trace how the Users request query parameters are serialized and verify whether the service or SDK drops top. Done means the combined request honors top=10, or the issue is documented as an upstream service limitation.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.