Problem officeLocation only
Grazouillis opened this issue · comments
Hello David,
I use your package on a project.
I'm not sure the problem I noticed is due to your library, but maybe you can confirm/infirm and it could help...
I observe a problem only with Laravel but not with my API client.
Indeed , this query works perfectly with Insomnia or Postman :
https://graph.microsoft.com/v1.0/users?$filter=accountEnabled eq true and startswith(userPrincipalName, 'm') and startswith(officeLocation,'ens') &$count=true&$top=999
When I try to use this in Laravel
$ens = Http::withToken($token)
->get('https://graph.microsoft.com/v1.0/users?$filter=accountEnabled eq true
and startswith(userPrincipalName, \'m\')
and startswith(officeLocation, \'ens\')
&$count=true&$top=999');
It doesn't work and give this error :
Unsupported or invalid query filter clause specified for property 'officeLocation' of resource 'User'."
However this query works perfectly:
$ens = Http::withToken($token)
->get('https://graph.microsoft.com/v1.0/users?$filter=accountEnabled eq true
and startswith(userPrincipalName, \'m\')
&$count=true&$top=999');
The credentials/token I use in Insomnia and my Laravel project are obviously the same ones.
Do you have any idea about the reason which generates this problem please ?
Sorry if I am in the wrong place to ask this question.
Thank you,
Reka
Damn, my awesome colleague finds the answer:
$ens = Http::withHeaders(["ConsistencyLevel" => 'eventual'])->withToken($token)->get('https://graph.microsoft.com/v1.0/users?$filter=accountEnabled eq true and startswith(userPrincipalName, \'m\') and startswith(officeLocation, \'ens\')&$count=true&$top=999');
I missed this hack: Http::withHeaders(["ConsistencyLevel" => 'eventual']), now it works fine!
Sorry for bothering you 🥲
Have a nice day!