我正在使用下面提到的图API-"client.api(/users/${data_body.payload.originEmail}/messages/${data_body.payload.emailId}/attachments/${data_body.payload.attachmentId}/$value
(.getStream((">
如果附件类型是";文件附件";但是这个api在";引用附件";我还查阅了文件,上面写着";试图获得引用附件的$值返回HTTP 405
并且它不返回contentBytes在此处输入图像描述
网站参考-https://learn.microsoft.com/en-us/graph/api/attachment-get?view=graph-rest-1.0&tabs=http1:https://i.stack.imgur.com/fGrft.png
有人有任何解决方案来获取参考附件的内容数据吗。如果是的话,那将是一个很大的帮助!!提前感谢
获取/驱动器/项目/{项目ID}?select=id,@microsoft.graph.downloadUrl
响应=>单击打开
在这里你可以看到下载URL在响应中丢失
graph v1.0端点不支持引用附件(除了向您显示电子邮件中存在的引用附件(。你需要切换到测试版端点,它将提供有问题附件的源URL,例如https://developer.microsoft.com/en-us/graph/docs/api-reference/beta/resources/referenceattachment
例如
https://graph.microsoft.com/beta/me/mailfolders/inbox/messages/..AA=/attachments/AAM..
会给你一些类似的东西吗
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#users('..')/mailFolders('inbox')/messages('..')/attachments/$entity",
"@odata.type": "#microsoft.graph.referenceAttachment",
"id": "..",
"lastModifiedDateTime": "2022-04-11T23:53:54Z",
"name": "User1.text",
"contentType": "application/octet-stream",
"size": 565,
"isInline": false,
"sourceUrl": "https://..-my.sharepoint.com/personal/.._com/Documents/Attachments/User1.text",
"providerType": "oneDriveBusiness",
"thumbnailUrl": null,
"previewUrl": null,
"permission": "other",
"isFolder": false
}
然后,您需要获取源URL,并通过适用的API下载该源URL作为参考附件。例如,在本例中,它的Sharepoint,因此您可以使用Sharepoint API下载文件。