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

问题描述 投票:0回答:1

尝试将EWS创建的旧SOAP消息转换为现代Graph 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>[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>

如果我用base64解码MimeContent,将得到描述的结果,这会创建特定的“日期”,例如: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>

现在我尝试使用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":"[email protected]"
                }
            }
        ]

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

但是我得到的信息总是与“现在”的sentDateTime ...为什么?

也许有一个选项用我的“内容”而不是身体创建消息...

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?".....,....
     ......
     ......

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

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

谢谢

office365 exchangewebservices microsoft-graph outlook-restapi
1个回答
2
投票

不。你不能这样做。存储/运输在创建和交付项目时标记项目上的日期。由于许多原因,保持这一领域的准确性是很好的,例如法律保持/合规等......

© www.soinside.com 2019 - 2024. All rights reserved.