首页 > 解决方案 > html 中的 Microsoft onedrive

问题描述

我在这里有这段代码来读取 onedrive 上的文件:

PATCH /me/drive/items/{item-id}

Content-type: application/json

{
  "name": "new-file-name.docx"
}

并更新文件:

PUT /me/drive/items/{item-id}/content
Content-Type: text/plain

The contents of the file goes here.

但是我在哪里登录我的微软帐户?

标签: javascriptmicrosoft-graph-apimicrosoft-graph-files

解决方案


当您使用 JavaScript 时,您需要创建将执行这些操作的应用程序。有一个 SDK 可用于访问 Microsoft Graph,并且您可以将 MSAL 库用于 JavaScript,从而更容易执行身份验证。

完整的过程有点太长,无法在一个回复中描述。出于这个原因,我强烈建议您遵循 Microsoft Learn 上的本教程:https ://docs.microsoft.com/en-us/learn/modules/msgraph-manage-files/


推荐阅读