我正在开发一个多租户守护程序应用程序。应用程序需要代表用户发送电子邮件。应用程序发送的电子邮件必须包含来自用户收件箱的另一封电子邮件作为附件。
这可以通过简单地引用现有电子邮件的 id 而不是下载现有电子邮件的内容来实现吗?
我正在尝试下面这样的事情。使用sendMailapi 并尝试将现有电子邮件项目作为附件引用。但我收到此错误:
无法处理抽象类型的输入
Microsoft.OutlookServices.Item
我是在正确的方向吗?实现此用例的最佳方法是什么。
POST https://graph.microsoft.com/v1.0/me/sendMail HTTP/1.1
authorization: bearer {access_token}
content-type: application/json
content-length: 96
{
"message": {
"subject": "Meet for lunch?",
"body": {
"contentType": "Text",
"content": "The new cafeteria is open."
},
"toRecipients": [{
"emailAddress": {
"address": "garthf@a830edad9050849NDA1.onmicrosoft.com"
}
}],
"attachments": [
"@odata.type": "#Microsoft.OutlookServices.ItemAttachment",
"name": "menu.txt",
"item": {
"id": "AAMkADBlOWNlOWExLTdjMzktNDI5NC04MDY3LTRiZGM2NTIxMzUyNABGAAAAAAC11nCh2QXMSJ7F766v_WCUBwBSt5DMAwrBRJGMMbg9jqoYAAAGNiHGAABSt5DMAwrBRJGMMbg9jqoYAAAJXgInAAA="
<!--This is the id of an existing email in User's inbox -->
}
]
},
"saveToSentItems": "false"
}
Run Code Online (Sandbox Code Playgroud)