Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to filter users by assigned license using ms-graph

I'm trying this request:

https://graph.microsoft.com/v1.0/users?
$filter=assignedLicenses/any(d:d/skuid eq 28d45cd1-ad8b-15cd-a9e1-52e6a5c24328)

But I get this error:

BadRequest - ')' or ',' expected at position 71 in 'assignedLicenses/any(d: d/skuid eq 28d45cd1-ad8b-15cd-a9e1-52e6a5c24328'.

Am I doing anything wrong? is this query possible?

like image 982
Traz Avatar asked Apr 23 '17 22:04

Traz


2 Answers

Just an update that this is now a supported API call. The correct syntax is:

https://graph.microsoft.com/v1.0/users?$filter=assignedLicenses/any(x:x/skuId eq e578b273-6db4-4691-bba0-8d691f4da603)

e578b273-6db4-4691-bba0-8d691f4da603 is Faculty A3 SKU in this example

like image 197
Ryan Avatar answered Sep 29 '22 20:09

Ryan


In general, only those properties where the documentation says "supports $filter" can be filtered.

E.g. on the user object, accountEnabled can be filtered.

Since the assignedLicenses property doesn't say it, and the assignedLicense resource type doesn't have it documented on the skuId property, I don't think you can perform that query.

like image 26
RasmusW Avatar answered Sep 29 '22 19:09

RasmusW