我有一小段代码:
$url = "https://outlook.office365.com/api/v1.0/me/messages"
$date = Get-Date -Format "yyyy-MM-dd"
$messageQuery = "" + $url + "?`$select=Id&`$filter=HasAttachments eq true and DateTimeReceived ge " + $date
$messages = Invoke-RestMethod $messageQuery -Credential $cred
foreach ($message in $messages.value)
{我尝试从11个不同的电子邮件…下载11个附件但我只有10个…Invoke-RestMethod中是否有限制?是我能找到的唯一原因,因为它可以完美地工作多达10个附件…
发布于 2018-02-27 19:15:20
对来自https://outlook.office365.com/api/v1.0/me/messages的响应进行寻呼。
每页的默认项目数为10。
您最多可以请求50个请求。
当涉及到分页以检查"@odata.nextLink"的响应体时,最重要的部分,例如
"@odata.nextLink": "https://outlook.office365.com/api/v1.0/me/messages/?%24top=10&%24skip=10"如果存在,请单击该链接转到下一页结果!
发布于 2018-02-27 21:05:16
将$top参数添加到您的QueryString (如果没有其他参数):
$url = "https://outlook.office365.com/api/v1.0/me/messages?\`$top=50" 或者:
$messageQuery = "" + $url + "?`$select=Id&`$filter=HasAttachments eq true and DateTimeReceived ge " + $date + '&top=50'https://stackoverflow.com/questions/49007052
复制相似问题