msgraph-sdk-php
msgraph-sdk-php copied to clipboard
The `top` and `filter` query parameters do not work together
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());