使用展开childFolders从microsoft graph api调用获取超过10个子文件夹

问题描述 投票:0回答:1

我遇到了以下终点,我希望它返回所有子文件夹,但它似乎仅默认为前 10 个。不过我想返回超过 10 个。因此我做了一些搜索并添加了 $top=100 (也尝试了 30),但这没有什么区别。

https://graph.microsoft.com/v1.0/me/mailFolders?$top=100&$expand=childFolders

需要什么才能让它返回前 100 个子文件夹?

完整方法如下:

const headers = new Headers();
headers.append("Authorization", "Bearer " + accessToken);

const response = await fetch(`https://graph.microsoft.com/v1.0/me/mailFolders?$top=100&$expand=childFolders`, {
  method: "GET",
  headers: headers,
});

if (!response.ok) {
  throw new Error("GraphApi call failed to authenticate: " + response.statusText);
}

const data = await response.json();
reactjs microsoft-graph-api office365
1个回答
0
投票

尝试在

$top
中使用
$expand
覆盖要返回 10 个子文件夹的默认值。

https://graph.microsoft.com/v1.0/me/mailFolders?$expand=childFolders($top=100)
© www.soinside.com 2019 - 2024. All rights reserved.