向Microsoft图形发布请求时,
POST 'https://graph.microsoft.com/v1.0/me/drive/root:/017_2018-08-12_18.47.27.jpg:/createLink'
content-type': 'application/json
{
"type": "embed"
}
我只得到
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#permission",
"@odata.type": "#microsoft.graph.permission",
"id": "5o98ENjWYH2pNK8wO5_d7QHUrdk",
"roles": ["read"],
"shareId": "s!AgDP2w-bgvZL****evpaN2yel",
"link": {
"type": "embed",
"webUrl": "https://onedrive.live.com/embed?resid=4B****U"
但是根据documentation,我还应该获得具有Iframe链接的WebHtml,不仅是webUrl,而且这正是我所要的,因此我可以为照片生成链接并将其放在网站上。
我做错了什么还是有什么办法解决,所以我可以获得与手动单击onedrive生成的嵌入url相同的信息吗?
我正在使用一个个人驱动器帐户。
答案 0 :(得分:0)
对我来说,在图资源管理器上尝试此操作不适用于v1.0端点。但是,使用beta端点确实确实会返回webHtml
属性,如下所示
基本上,您需要做的是将网址中的v1.0
段更改为beta
。
POST 'https://graph.microsoft.com/beta/me/drive/root:/017_2018-08-12_18.47.27.jpg:/createLink'
content-type': 'application/json
{
"type": "embed"
}
您应该找回这样的东西
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#permission",
"@odata.type": "#microsoft.graph.permission",
"id": "p6z1ZAtRqKFwqHNVfaa6mPFQIyI",
"roles": [
"read"
],
"shareId": "s!AorKRTkoJljsixZbAANWreQhS7gk",
"expirationDateTime": "0001-01-01T00:00:00Z",
"hasPassword": false,
"link": {
"type": "embed",
"webUrl": "https://onedrive.live.com/embed?resid=EC5826283945CA8A%211430&authkey=!AFsAA1at5CFLuCQ",
"webHtml": "<iframe src=\"https://onedrive.live.com/embed?resid=EC5826283945CA8A%211430&authkey=!AFsAA1at5CFLuCQ\" width=\"98\" height=\"120\" frameborder=\"0\" scrolling=\"no\"></iframe>"
}
}