有什么方法可以使用 Graph/office REST API 创建具有特定日期(即 create/sentDateTime/updateDateTime)的消息/(收件箱邮件)?

Is there any way to create message/(inbox mail) with specific date (i.e create/sentDateTime/updateDateTime) using Graph/ office REST API?

尝试将 EWS 创建的旧 SOAP 消息转换为现代图形 API,之前我成功创建了具有特定日期的消息,因为发送的 MimeConent 已经包含日期示例:

           <?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>admin@xxx.com</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>

如果我用 base64 解码 MimeContent,将得到描述的结果,这为我创建了特定的 "dates",例如:createTime...

Date: Thu, 22 Jun 2017 11:36:01 +0000 (UTC)
From: valekseev@zzzzz.com
To: xxx@yyyy.zzzzz.com
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>

现在我正在尝试对 REST 做同样的事情 API(值不同,但没关系):

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":"AdeleV@contoso.onmicrosoft.com"
                }
            }
        ]

    , "singleValueExtendedProperties": [
          {
             "id":"Integer 0x0E07",
             "value":"4"
          }
        ]
     }
    }

但是我总是收到 "now" 的 sentDateTime 的消息...为什么?

也许有一个选项可以用我的"content"而不是正文创建消息...

输出:

    "@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":"<MWHPR130@MWHPR130.namprd13.prod.outlook.com>",
    "subject":"Did you see last night's game?".....,....
     ......
     ......

是否可以像我之前使用 EWS 那样创建具有特定创建日期的消息...也许一些 MAPI 属性,例如:

https://msdn.microsoft.com/en-us/library/office/cc765677.aspx

谢谢

没有。你不能那样做。 Store/Transport 在创建和交付项目时在项目上标记日期。出于多种原因,最好保持此字段准确,例如合法 hold/compliance,等等...

无法修改

PR_CREATION_TIMEPR_LAST_MODIFICATION_TIME MAPI 属性,但由于某些原因可以修改 PR_CLIENT_SUBMIT_TIMEPR_MESSAGE_DELIVERY_TIME。 这样做会相应地更新 sentDateTimereceivedDateTime