[英]Is there a way to get Attachments url from Microsoft Graph Subscription response?
I'm trying to include Microsoft Graph API mail subscription in a Javascript project with @microsoft/microsoft-graph-client
, I get an object response (body, subject, cc, to...etc) and a Boolean hasAttachments: true
but the attachment url is nowhere to be found, is there a way to get these attachments?我正在尝试将 Microsoft Graph API 邮件订阅包含在带有@microsoft/microsoft-graph-client
的 Javascript 项目中,我收到 object 响应(正文、主题、抄送、收件人...等)和 Boolean hasAttachments: true
但附件url找不到了,请问有办法获取这些附件吗?
when you got the message try this url GET /me/messages/{id}/attachments/{id}当你收到消息时试试这个 url GET /me/messages/{id}/attachments/{id}
Ok i tried this Graph API call using Javascript code and it's working for me (get the .txt file):好的,我使用 Javascript 代码尝试了这个 Graph API 调用,它对我有用(获取 .txt 文件):
const options = { authProvider, }; const client = Client.init(options); let res = await client.api('/me/messages/AAMkAGRlNWM4Njk4LWY3NTYtNGE2MC05ZjQzLTg1YmM5YjIzNTRhMwBGAAAAAAA-L78mmzKFQ7FpvCcWkAziBwCUgufVfU8cSKxkYzIkrl81AAAAAAEMAACUgufVfU8cSKxkYzIkrl81AACABFjMAAA=/attachments/AAMkAGRlNWM4Njk4LWY3NTYtNGE2MC05ZjQzLTg1YmM5YjIzNTRhMwBGAAAAAAA-L78mmzKFQ7FpvCcWkAziBwCUgufVfU8cSKxkYzIkrl81AAAAAAEMAACUgufVfU8cSKxkYzIkrl81AACABFjMAAABEgAQAHhM4mZxBRNBqkVbYUzUcWA=').get();
and to convert the contentbytes and store it locally refer the related link - download attachments from mail using microsoft graph rest api as well.并转换 contentbytes 并将其存储在本地,请参考相关链接 - 也使用 microsoft graph rest api 从邮件下载附件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.