【发布时间】:2025-12-03 11:40:01
【问题描述】:
我想通过 Microsoft Graph REST API 获取我最近使用的文件夹。 此 API 包含以下内容:
获取https://graph.microsoft.com/v1.0/me/drive/recent
根据references,结果应如下所示:
{
"value": [
{
"id": "1312abc!1231",
"remoteItem":
{
"id": "1991210caf!192",
"name": "March Proposal.docx",
"file": { },
"size": 19121,
"parentReference": {
"driveId": "1991210caf",
"id": "1991210caf!104"
}
}
},
{
"id": "1312def!9943",
"name": "Vacation.jpg",
"file": { },
"size": 37810,
"parentReference": {
"driveId": "1312def",
"id": "1312def!123"
}
}
]
}
如果结果是这样的,我可以通过使用 parentReference 的 driveId 和 id 来获取父文件夹,但在我的结果中我只得到 driveId。这导致需要对 graph 进行一次额外的调用以获取文件夹。
这意味着我需要 3 次调用图形 API 来获取最近的文件夹。
我的问题是是否有办法同时获取 id 或 parentReference,所以我只需要两次调用,或者是否有更简单的方法来获取最近的文件夹?
提前致谢!
【问题讨论】:
标签: onedrive microsoft-graph-api