I run this code and only returning the first 100 records, not sure why.
Can you please advise?
I belive this is what I should modify but don't know how:
$select=displayName,userPrincipalName,signInActivity
This is the full code:
Invoke-WebRequest -Headers $AuthHeader1 -Uri "https://graph.microsoft.com/beta/users?`$select=displayName,userPrincipalName,signInActivity" -UseBasicParsing
Update:
$LastLogin = Invoke-WebRequest -Headers $AuthHeader1 -Uri "https://graph.microsoft.com/beta/users?`$top=999&$select=displayName,userPrincipalName,signInActivity&$skiptoken=Paged=TRUE&$odata.nextlink" -UseBasicParsing
$NextLink = $LastLogin."@odata.nextLink"
$LastLoginpage2 = Invoke-WebRequest -Method Get -Headers $AuthHeader1 -Uri '$NextLink' -UseBasicParsing
Thanks.
Gabor
By default every API has its own limit per page to give number of records as a response. Here the
/users
gives 100 users per page and additionally it gives a @odata.nextLink as a reference to the next page as shown below in the image.You can use the odata.nextLink and make another call and get the next page of users.
If you want to modify the limit per page, you can use $top query parameter to get 200 or 300 user objects per page. Use the below query to get 200 records per page.