简体   繁体   English

html 中的微软 onedrive

[英]Microsoft onedrive in html

I have this code here to read a file on onedrive:我在这里有这段代码来读取 onedrive 上的文件:

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

Content-type: application/json

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

And to update a file:并更新文件:

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

The contents of the file goes here.

But where to I login to my microsoft account?但是我在哪里登录我的微软帐户?

As you are using JavaScript, you would need to create the application that would perform these operations.当您使用 JavaScript 时,您需要创建执行这些操作的应用程序。 There is a SDK that you can use to access Microsoft Graph, and you can use MSAL libraries for JavaScript which makes it easier to perform authentication.有一个 SDK 可用于访问 Microsoft Graph,并且您可以使用 JavaScript 的 MSAL 库,这使得执行身份验证更加容易。

Complete process is a bit too long to be described in a single reply.完整的过程有点太长,无法在一个回复中描述。 For that reason, I strongly recommend that you follow this tutorial on Microsoft Learn: https://docs.microsoft.com/en-us/learn/modules/msgraph-manage-files/因此,我强烈建议您遵循 Microsoft Learn 上的本教程: https://docs.microsoft.com/en-us/learn/modules/msgraph-manage-files/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM