MSGraph 设置查询页面大小(而不是使用跳过令牌) [英] MSGraph set query page size (instead of using skip token)

查看:46
本文介绍了MSGraph 设置查询页面大小(而不是使用跳过令牌)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将如何从公司获取所有用户,以下查询仍然只返回 100 个项目:

How would I go about fetching all users from a company, the following query still only returns 100 items:

https://graph.microsoft.com/v1.0/users?$pageSize=200

虽然这可能是因为文档说:

Though this might be because the documentation says:

Paging is not supported for link searches, such as for querying group members.

我假设这适用于用户查询.虽然我不完全明白为什么,也不明白我还能如何获取其他用户.

I assume this applies to the users query. Though I don't fully understand why, nor do I understand how else I would fetch the rest of the users.

任何帮助将不胜感激.

好的,所以我发现每个页面都会给你一个skiptoken,这是用户下一页的网址.这使得事情比他们需要的要复杂得多.我将这个问题改写为;有没有更简单的方法来获取所有用户?

edit: Okay so I found out every page gives you a skiptoken, which is an url to the next page of users. This makes things a lot more complicated than they need to be. I'll rephrase this question to; is there an easier way to fetch all users?

推荐答案

我自己没有使用过 pageSize 参数,但我使用了 $top ,它的行为应该类似.使用 top 你可以告诉 graph 最多返回 999 个结果,这已经足够了.

Haven't used pageSize param myself but I've used $top which should behave similarly. Using top you can tell graph to return up to 999 results, which is enough hopefully.

跳过令牌使事情变得更加复杂,但是它们确实为您提供了对分页/无限滚动的访问权限(但是您希望实现您的逻辑).如果您不需要它,您只需执行 $top=999 表示您需要多少次并返回汇总结果.

Skip tokens make stuff more complicated, however they do provide you with access to paging/infinite scroll (however you wish to implement your logic). And if you do not need that, you can just do $top=999 for how many times do you need and return the aggregated results.

这篇关于MSGraph 设置查询页面大小(而不是使用跳过令牌)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆