Powershell 调用WebRequest仅返回100个值

Powershell 调用WebRequest仅返回100个值,powershell,microsoft-graph-api,invoke-webrequest,Powershell,Microsoft Graph Api,Invoke Webrequest,我运行这段代码,只返回前100条记录,不知道为什么 你能给个建议吗 我相信这是我应该修改的,但不知道如何修改: $select=displayName,userPrincipalName,signInActivity 这是完整的代码: Invoke-WebRequest -Headers $AuthHeader1 -Uri "https://graph.microsoft.com/beta/users?`$select=displayName,userPrincipalName,si

我运行这段代码,只返回前100条记录,不知道为什么

你能给个建议吗

我相信这是我应该修改的,但不知道如何修改:

$select=displayName,userPrincipalName,signInActivity
这是完整的代码:

Invoke-WebRequest -Headers $AuthHeader1 -Uri "https://graph.microsoft.com/beta/users?`$select=displayName,userPrincipalName,signInActivity" -UseBasicParsing
更新:

$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
谢谢


Gabor

默认情况下,每个API都有自己的记录数作为响应。此处,
/users
为每页提供100个用户,另外还提供了一个@odata.nextLink作为对下一页的引用,如下图所示

您可以使用odata.nextLink进行另一次调用,并获得下一页的用户

如果要修改每页的限制,可以使用每页获取200或300个用户对象。使用下面的查询每页获取200条记录

GET https://graph.microsoft.com/v1.0/users?$top=200&$select=displayName,userPrincipalName,signInActivity

谢谢,现在我面临的问题是,我只能在一个请求中查询1000个用户。关于如何在一个查询中请求上的所有用户,您有什么建议吗?是的,API按照分页中的指定工作。因此,您可以指定每页的限制(最多可以得到999),然后使用odata.nextlink,再调用一次以获得下一页的用户。我使用:$LastLogin=Invoke WebRequest-Headers$AuthHeader1-Uri”“`$top=999&$select=displayName、userPrincipalName、signanActivity&$skiptoken=Paged=TRUE&$odata.nextlink”-UseBasicParsing$NextLink=$LastLogin.@odata.NextLink“$LastLoginpage2=Invoke WebRequest-Method Get-Headers$AuthHeader1-Uri'$NextLink'-UseBasicParsing当我尝试获取下一个链接时,变量似乎是空的。我还将此代码添加到顶部,以便您可以更好地查看