0

I'm wanna query like the condition below.

"E5 Licensed Users with LastSignInDateTime Delayed by More than 30 Days"

The method I used for the query is as follows.

$skuID = Invoke-RestMethod -Uri 'https://graph.microsoft.com/beta/users?$filter=signInActivity/lastSignInDateTime le 2020-08-01T00:00:00Z and (assignedLicenses @{skuId} eq "c7df2760-2c81-4ef7-b578-5b5392b571df")' -Headers $Headers

but it doesn't work.

Invoke-RestMethod : { "error": { "code": "BadRequest", "message": "Invalid filter clause", "innerError": { "date": "2020-08-31T11:46:15", "request-id": "eeb58015-c6c2-437d-af1d-93227224133e" } } } 위치 줄:1 문자:10

  • $skuID = Invoke-RestMethod -Uri 'https://graph.microsoft.com/beta/use ...
  •      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
    • FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand

Is there any way?

+And if you look up the user in API, only 100 people can be inquired. Is there a way to check all users?

this is Graph API's limit what I found.

https://learn.microsoft.com/en-us/graph/throttling#pattern

1
  • Please try this Graph api in graph explorer https://graph.microsoft.com/beta/users?$filter=signInActivity/lastSignInDateTime le 2020-08-01T00:00:00Z&assignedLicenses/any(x:x/skuId eq XXX7a907fd6c235)&$select=id,displayname and let us know if it helps. Commented Aug 31, 2020 at 12:37

1 Answer 1

0

Please try this Graph API in graph explorer

Get https://graph.microsoft.com/beta/users?$filter=signInActivity/lastSignInDateTime le 2020-08-01T00:00:00Z&assignedLicenses/any(x:x/skuId eq XXX7a907fd6c235)&$select=displayname

enter image description here

Sign up to request clarification or add additional context in comments.

4 Comments

Thanks a lot!! I have one more question, Graph API has a limitation, Now is only 100 people can be inquired. Is there a way to check all users?
@ciscons /users?$top={totalCount} will help. see here.
You will get top 999 users using this query https://graph.microsoft.com/beta/users?$Top=999&$filter=signInActivity/lastSignInDateTime le 2020-08-01T00:00:00Z&assignedLicenses/any(x:x/skuId eq XXX7a907fd6c235)&$select=displayname for iteration please check this document
According to the documentation "and" is the right way to filter on multiple properties. Using & instead is the url syntax for another property, thus not considered part of filter. In my test the query was accepted, but the part after & ignored. According to the thread here: github.com/microsoftgraph/microsoft-graph-docs/issues/7228, a signInActivity/lastSignInDateTime filter cannot be combined with filtering on other properties. I have not seen that in Microsofts documentation, but fits what I experience.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.