使用 Ms Graph Api 将附件文件从 outlook 复制到 onedrive 而不下载

Copy an attachment file from outlook to onedrive using Ms Graph Api without download it

我有一个使用 Graph Api (v1) 在 outlook 中检查电子邮件的机器人。

我想将电子邮件中的附件文件复制到 onedrive 文件夹中而不下载。

我知道我可以使用 Flow 来完成它,但它对我的任务来说不方便。

所以我试试看:

POST https://graph.microsoft.com/v1.0/me/drive/root/children 内容类型:application/json 首选:异步响应

{
"@microsoft.graph.fileAttachment": "https://graph.microsoft.com/v1.0/me/messages/{message_id}/Attachments/{attachment_id}/$value",
"name": "test.pdf",
"file": {}}

这会创建文件但里面没有数据...(0 字节文件)

参考:https://docs.microsoft.com/fr-fr/onedrive/developer/rest-api/api/driveitem_upload_url?view=odsp-graph-online

目前不支持...

参考:Microsoft Support