When using the MS Graph API to POST a Mail message, the message is created in DRAFT mode. Is there any way to create a new regular mail message which is not in DRAFT? In addition, is there any option to POST a new message using MIME format in the body?
1 Answers
1
votes
When you create the Message you need to set the MessageFlags extended property to make it appear as if it was a Sent Message. You generally also want to set the ClientSubmitTime https://docs.microsoft.com/en-us/office/client-developer/outlook/mapi/pidtagclientsubmittime-canonical-property and the delivery time https://docs.microsoft.com/en-us/office/client-developer/outlook/mapi/pidtagmessagedeliverytime-canonical-property which affect how the messages will sort in Outlook. For MIME its export only in Beta at the moment https://developer.microsoft.com/en-us/graph/blogs/mime-format-support-for-microsoft-graph-apis-preview/
{
"Subject": "test1234",
"Sender": {
"EmailAddress": {
"Name": "blah",
"Address": "[email protected]"
}
},
"Body": {
"ContentType": "HTML",
"Content": "123Body"
},
"SingleValueExtendedProperties": [
{
"PropertyId": "Integer 0x0E07",
"Value": "1"
},
{
"PropertyId": "SystemTime 0x0039",
"Value": "2019-06-12T10:10:47.2048+10:00"
},
{
"PropertyId": "SystemTime 0x0E06",
"Value": "2019-06-12T10:10:47.2048+10:00"
}
]
}