I'm trying to create apps that using Outlook API. The first feature that i want to create is integrate Outlook Mail to my app. But i have problem to reply email, when i try to send email using POST:
POST: https://outlook.office.com/api/v2.0/Users/email/sendmail
{
"Message": {
"Subject": "Test",
"Importance": "Normal",
"ToRecipients": [{
"EmailAddress": {
"Address": "[email protected]",
"Name": "jais anas"
}
}],
"Body": {
"ContentType": "HTML",
"Content": "Bangsaaaaat aneh"
}
},
"SaveToSentItems": "true"
}
the response only return status code 202 accepted
the body is empty, then i research and find people who face the same the situation like here
it recommends using PR_SEARCH_KEY
. I try to embed PR_SEARCH_KEY
like below:
{
"Subject": "Test",
"Importance": "Normal",
"ToRecipients": [{
"EmailAddress": {
"Address": "[email protected]",
"Name": "jais anas"
}
}],
"Body": {
"ContentType": "HTML",
"Content": "ultra aneh"
},
"SingleValueExtendedProperties": [
{
"PropertyId":"String {66f5a359-4659-4830-9070-00040ec6ac6e} Name Fun",
"Value":"Food"
}
],
"IsDraft": false
}
it returns response that what i expected:
{
"@odata.context": "https://outlook.office.com/api/v2.0/$metadata#Me/Messages/$entity",
"@odata.id": "https://outlook.office.com/api/v2.0/Users('ae679c71-8bf5-4b97-bdf4-77139f637325@b3177487-e927-4ded-ba13-787dec0ebbca')/Messages('AAMkAGM4MTk2Nzg2LTgzODktNGEzYi05NmU0LTU5ODc4OTMxNTZiZQBGAAAAAADuF3VB4SlIT6v3u7na6JIHBwCfoOdZk3FLQau_3XsCiAazAAAAAAEPAACfoOdZk3FLQau_3XsCiAazAAEpvIT5AAA=')",
"@odata.etag": "W/\"CQAAABYAAACfoOdZk3FLQau+3XsCiAazAAEp7BTR\"",
"Id": "AAMkAGM4MTk2Nzg2LTgzODktNGEzYi05NmU0LTU5ODc4OTMxNTZiZQBGAAAAAADuF3VB4SlIT6v3u7na6JIHBwCfoOdZk3FLQau_3XsCiAazAAAAAAEPAACfoOdZk3FLQau_3XsCiAazAAEpvIT5AAA=",
"CreatedDateTime": "2018-03-12T15:36:30Z",
"LastModifiedDateTime": "2018-03-12T15:36:31Z",
"ChangeKey": "CQAAABYAAACfoOdZk3FLQau+3XsCiAazAAEp7BTR",
"Categories": [],
"ReceivedDateTime": "2018-03-12T15:36:31Z",
"SentDateTime": "2018-03-12T15:36:31Z",
"HasAttachments": false,
"InternetMessageId": "<PS1PR06MB124320CE100FA9B65B0A1753AAD30@PS1PR06MB1243.apcprd06.prod.outlook.com>",
"Subject": "Test",
"BodyPreview": "ultra aneh",
"Importance": "Normal",
"ParentFolderId": "AQMkAGM4MTk2Nzg2LTgzODktNGEzYi05NmU0LTU5ODc4OTMxNTZiZQAuAAAD7hd1QeEpSE_r97u52uiSBwEAn6DnWZNxS0Grvt17AogGswAAAgEPAAAA",
"ConversationId": "AAQkAGM4MTk2Nzg2LTgzODktNGEzYi05NmU0LTU5ODc4OTMxNTZiZQAQAHF_FKARNjtGuOFXHfrijQE=",
"IsDeliveryReceiptRequested": false,
"IsReadReceiptRequested": false,
"IsRead": true,
"IsDraft": true,
"WebLink": "https://outlook.office365.com/owa/?ItemID=AAMkAGM4MTk2Nzg2LTgzODktNGEzYi05NmU0LTU5ODc4OTMxNTZiZQBGAAAAAADuF3VB4SlIT6v3u7na6JIHBwCfoOdZk3FLQau%2B3XsCiAazAAAAAAEPAACfoOdZk3FLQau%2B3XsCiAazAAEpvIT5AAA%3D&exvsurl=1&viewmodel=ReadMessageItem",
"InferenceClassification": "Focused",
"Body": {
"ContentType": "HTML",
"Content": "<html>\r\n<head>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\r\n<meta content=\"text/html; charset=us-ascii\">\r\n</head>\r\n<body>\r\nultra aneh\r\n</body>\r\n</html>\r\n"
},
"ToRecipients": [
{
"EmailAddress": {
"Name": "jais anas",
"Address": "[email protected]"
}
}
],
"CcRecipients": [],
"BccRecipients": [],
"ReplyTo": [],
"Flag": {
"FlagStatus": "NotFlagged"
}
}
Unfortunately that post only create draft does not send email. you can check in part of "IsDraft": true
. My question is how to get id of sent items without store message to draft ? i don't see any documentation how to get id from sent email here