【发布时间】:2018-05-08 07:16:01
【问题描述】:
我一直在尝试为 OneDrive 生成一个公共的可下载 URL
对于 Business 和 SharePoint DriveItem 对象,使用 /createLink api。
curl \
-X POST \
-d '{"type":"view","scope":"anonymous"}' \
-H 'Authorization: bearer xxx_Access_Token_xxx' \
-H 'Content-Type: application/json' \
"https://graph.microsoft.com/v1.0/drive/items/<item-id>/createLink"
上述调用返回 JSON 结果,其中 body.link.webUrl (https://my.sharepoint.com/:u:/g/XXXXrKmGKlXXXXXXXXXXsq0Bh3x4TTXXXXXXXXXXXXXXXXX) 是可共享的 URL。但是,此链接不直接包含对文件的引用。
根据this 评论,将download=1 作为查询字符串参数附加到生成的共享URL 将允许用户直接打开原始文件。但我找不到任何支持这种行为的文档。
可以吗
- 直接下载文件。
- 将公共 URL 用作
img标记的src属性。
【问题讨论】:
标签: microsoft-graph-api onedrive