Trying convert old SOAP message created by EWS to modern Graph API , Previously I succeed to create a message with specific dates due to sending MimeConent which already includes with dates Example:
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
<soap:Header>
<t:RequestServerVersion Version="Exchange2016" />
<t:ExchangeImpersonation>
<t:ConnectingSID>
<t:PrincipalName>[email protected]</t:PrincipalName>
</t:ConnectingSID>
</t:ExchangeImpersonation>
</soap:Header>
<soap:Body>
<CreateItem xmlns="http://schemas.microsoft.com/exchange/services/2006/messages" MessageDisposition="SaveOnly" SendMeetingInvitations="SendToNone">
<SavedItemFolderId>
<t:FolderId Id="AAMkAGM5MDIzODk0LTg2NmMtNDE3YS05M2YwLTBhZjgzZWQxODUxYQAuAAAAAAAX07OCLT/gQbX2qJJIVqojAQCdUXzQSXe1Tqh1KvhfGj3SAARQNYfhAAA=" ChangeKey="AQAAABYAAACdUXzQSXe1Tqh1KvhfGj3SAARSy240" />
</SavedItemFolderId>
<Items>
<t:Message>
//here MimeContent that has the specific dates....how to
do that with REST ??????
<t:MimeContent CharacterSet="UTF-8">
......{BASE 64 ........} </t:MimeContent>
<t:ReminderIsSet>false</t:ReminderIsSet>
<t:ExtendedProperty>
<t:ExtendedFieldURI PropertyTag="0x0E07" PropertyType="Integer" />
<t:Value>4</t:Value>
</t:ExtendedProperty>
</t:Message>
</Items>
</CreateItem>
</soap:Body>
</soap:Envelope>
if I'll decode the MimeContent with base64 , will get the result as describes , and this creates me the specific "dates" such as: createTime...
Date: Thu, 22 Jun 2017 11:36:01 +0000 (UTC)
From: [email protected]
To: [email protected]
Message-ID: <CAP-g2LzDoXpYeP+7PPs3LJYQtTkPe9ErqD-SgnbHKYZkkw5YuA@mail.gmail.com>
Subject: Test OutOfMemory
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="----=_Part_0_1169672575.1519724417079"
------=_Part_0_1169672575.1519724417079
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta content="text/html; charset=utf-8">
</head>
<body>
<div dir="ltr">Test OutOfMemory<br>
</div>
</body>
</html>
Now I'm Trying to do the same with REST API (the value are different, but it doesn't matter):
POST https://graph.microsoft.com/beta/me/messages
Content-type: application/json
{
"subject":"Did you see last night's game?",
"importance":"Low",
"sentDateTime":"2016-12-23T07:29:58Z",
"body":{
"contentType":"HTML",
"content":"They were <b>awesome</b>!"
},
"toRecipients":[
{
"emailAddress":{
"address":"[email protected]"
}
}
]
, "singleValueExtendedProperties": [
{
"id":"Integer 0x0E07",
"value":"4"
}
]
}
}
BUT I The message that I got always with sentDateTime
of "now"... why?
Maybe is there an option to create message with my "content" instead of body...
OUTPUT:
"@odata.context":"https://graph.microsoft.com/beta/$metadata#users('ad787b4f-1fda-4523-8e48-ffedb7f4635f')/messages/$entity",
"@odata.etag":"W/\"CQAAABYAAAAmXr9SsE/UR4PcnTZcg7qWAAAFS12t\"",
"id":"AAMkAGRWAAAFSmKXAAA=",
// I want here to be "2016-12-23T07:29:58Z"
"createdDateTime":"2018-03-02T19:14:13Z",
"lastModifiedDateTime":"2018-03-02T19:14:13Z",
"changeKey":"CQAAABYAAAAmXr9SsE/UR4PcnTZcg7qWAAAFS12t",
"categories":[
],
"receivedDateTime": "2018-03-02T19:14:13Z",
"sentDateTime": "2018-03-02T19:14:13Z",
"hasAttachments":false,
"internetMessageId":"<[email protected]>",
"subject":"Did you see last night's game?".....,....
......
......
Is it possible to create a message with specific creation date like i did with EWS before...Maybe some MAPI Properties like :
https://msdn.microsoft.com/en-us/library/office/cc765677.aspx
Thanks
Nope. You can't do that. Store/Transport stamps the dates on the items when the items are created and delivered. For many reasons it is good to keep this field accurate, such as legal hold/compliance, etc...