如何使用图表 api 在 Onedrive 上获取文件 ID?

How can i get a files Id on Onedrive using the graph api?

我知道一个文件存在于一个驱动器中,TestFile.xlxs.It 位于文件夹中 Folder1/SubFolder2/SubFolder 2a/。我正在尝试按如下方式获取 fileId,因此我可以将文件移动到 OneDrive

中的另一个文件夹
https://graph.microsoft.com/v1.0/me/drive/root:/Folder1/SubFolder2/SubFolder 2a/TestFile.xlsx

但我收到错误

    "code": "BadRequest",
    "message": "Empty Payload. JSON content expected.",

关于如何获取文件 ID 的任何想法?

看起来您 POST 请求而不是 GET

GET https://graph.microsoft.com/v1.0/me/drive/root:/Folder1/SubFolder2/SubFolder 2a/TestFile.xlsx

POST 如果您将空 json 添加到请求正文中,请求可能会起作用。

{}