代码之家  ›  专栏  ›  技术社区  ›  Savageman

Microsoft Graph API邮件:用于删除邮件的webLink?

  •  0
  • Savageman  · 技术社区  · 8 年前

    我在想办法 webLink 向OWA发送已删除的邮件。普通邮件具有 网络链接 属性,但一旦删除,URL https://graph.microsoft.com/v1.0/me/messages/<the_id> 返回该有效负载,而不是消息信息:

    {
      "error": {
        "code": "ErrorItemNotFound",
        "message": "The specified object was not found in the store., The process failed to get the correct properties.",
        "innerError": {
          "request-id": "x-x-x-x",
          "date": "2018-04-17T00:00:00"
        }
      }
    }
    
    1 回复  |  直到 8 年前
        1
  •  1
  •   Glen Scales    8 年前

    删除邮件时(或者实际情况是邮件在邮箱中移动到“已删除邮件”文件夹或“保留邮件”文件夹之一),邮件的Id会发生更改,因此返回的错误与此一致。这就是为什么存储这些Id通常是个坏主意,因为如果邮件在文件夹等之间移动,同样的事情也会发生。您需要做的是根据消息的新位置(这取决于用于删除消息的方法)查找消息的新Id,并且您需要某种类型的搜索参数,如InternetMessageId应该可以工作,但像PittagSearchKey这样的唯一属性可能会更好 https://msdn.microsoft.com/en-us/library/office/cc815908.aspx?f=255&MSPPError=-2147217396 。但是,如果您在软删除或硬删除之前保存了上述邮件的Internet MessageId(这意味着它将最终位于RecoverableItemsDeletes文件夹中),那么您可以使用以下方法

    GET /v1.0/users('user@domain.com')/MailFolders/RecoverableItemsDeletions/messages/?$filter=internetMessageId+eq+%27%3c433353153.1229207532.1524008554985.JavaMail.root%40sjmas03.marketo.org%3e%27
    

    在新位置查找邮件

    推荐文章