javascript - 带有 Graph API 的 Outlook Web 插件 - 将当前项目作为 Outlook 项目附件发送时不显示内联图像
问题描述
我可以将我当前的项目作为附件发送,但我遇到了一个问题,如果我当前的项目中有任何内嵌图像,当我打开我的当前项目作为我新发送的附件时,这些不会正确显示/收到的邮件。我知道在将我的原始电子邮件作为附件发送后,图像 src 不正确,但我不确定如何纠正这个问题,或者这是否是预期的行为,因为我错过了一些东西。
我的目标是将我当前出现的项目/电子邮件作为 Outlook 项目转发到收件人邮箱。
我想知道我如何设置我发布到 Graph API 以发送邮件的 json 是否有错误?我会把它贴在下面,以防万一设置错误。提前致谢!
var email = client.api('/me/messages/' + restID).get();
var attachments = client.api('/me/messages/' + restID + '/attachments').get()
const sendMail = {
message: {
subject: 'This contains my original email',// forwardMailSubject,
body: {
contentType: "Text",
content: 'Test' // forwardMailBody
},
toRecipients: [
{
emailAddress: {
address: 'test12321@outlook.com' //forwardMailbox
}
}
],
attachments: [
{
'@odata.type': "#microsoft.graph.itemAttachment",
'name': "attachment",
'contentType': "html",
'item': {
"@odata.type": "#microsoft.graph.message",
"id": email.id,
"createdDateTime": email.createdDateTime,
"lastModifiedDateTime": email.lastModifiedDateTime,
"receivedDateTime": email.receivedDateTime,
"sentDateTime": email.sentDateTime,
"hasAttachments": true,
"internetMessageId": email.internetMessageId,
"subject": "Reminder - please bring laptop",
"importance": "normal",
"conversationId": email.conversationId,
"isDeliveryReceiptRequested": false,
"isReadReceiptRequested": false,
"isRead": false,
"isDraft": false,
"webLink": email.webLink,
"body": email.body,
"sender": email.sender,
"from": email.from,
"toRecipients": email.toRecipients,
"attachments": attachments
}
}
]
}
};
client.api('/me/sendMail')
.post(sendMail);
解决方案
推荐阅读
- python - 为什么我不能向 Django 中的对象添加多对多关系?
- swift - api返回的数据总是nil?
- c++ - 在 z 之后循环回到字母表的开头
- c - 将函数传递给函数 C
- linux - 为什么用户可以使用 passwd 更改他们的密码,即使他们不能直接写入 /etc/shadow 文件?
- javafx - 如何在 JavaFX 中获取详细的打印机信息
- javascript - 仅在输入两个或更多字符时触发 AJAX
- python - Numpy 的按位与对矩阵的行为不同错误
- reactjs - 当child是react组件而不是DOM元素时如何调整react.children的onClick事件
- python - 在给定的一组多边形内找到一组给定的点的矢量化实现