【问题标题】:Outlook Mail REST API: folder not found despite being in a messageOutlook Mail REST API:尽管在邮件中但未找到文件夹
【发布时间】:2017-05-12 02:43:05
【问题描述】:

我尝试使用 REST API 获取 Outlook 帐户的文件夹列表。

使用 MailFolders 端点,我只能获得文件夹的一个子集(例如,我没有获得 InboxSent Items 文件夹)。

如果我列出该帐户的所有消息,然后为每条消息尝试获取 ParentFolderId,我会收到一堆 404 错误。我只能获得从 MailFolders 端点获得的相同文件夹。

当然,这适用于我拥有的所有其他 Office 365 帐户。而且这个帐户看起来与其他帐户没有什么不同。

这不是文件夹被重命名的问题,因为我可以在 Outlook UI 中看到这些文件夹。

当然,在获取文件夹或列出消息时,我都正确地对结果进行了分页。这同样适用于所有其他 Outlook 帐户。

我正在使用https://outlook.office.com/api/v2.0/me/MailFolders?%24top=50 端点。

有什么见解吗?

谢谢,

杰里米

回应

HTTP/1.1 404 Not Found 

Cache-Control: private
Transfer-Encoding: chunked
Content-Type: application/json;odata.metadata=minimal;odata.streaming=true‌​;IEEE754Compatible=f‌​alse;charset=utf-8
Server: Microsoft-IIS/8.5
request-id: e98a3488-3441-474c-8cff-c905f8b9f299 
X-CalculatedFETarget: MWHPR1301CU001.internal.outlook.com
X-BackEndHttpStatus: 404
X-FEProxyInfo: MWHPR1301CA0012.NAMPRD13.PROD.OUTLOOK.COM
X-CalculatedBETarget: MWHPR16MB1661.namprd16.prod.outlook.com
X-BackEndHttpStatus: 404
OData-Version: 4.0
X-AspNet-Version: 4.0.30319
X-DiagInfo: MWHPR16MB1661
X-BEServer: MWHPR16MB1661
X-FEServer: MWHPR1301CA0012
X-Powered-By: ASP.NET
X-FEServer: BY2PR02CA0116
X-MSEdge-Ref: Ref A: 0872CED88164470BA7F119058A1F5CBF Ref B: BAYEDGE0318 Ref C: Thu Apr 27 10:58:51 2017 PST
Date: Thu, 27 Apr 2017 17:58:51 GMT

{
  "error":{
    "code":"ErrorItemNotFound",
    "message":"The specified object was not found in the store."
  }
}

【问题讨论】:

  • 您能否发布来自这些失败请求之一的响应标头?
  • 嗨,Jason,这是请求的详细信息。
  • 正文:{"error":{"code":"ErrorItemNotFound","message":"The specified object was not found in the store."}}
  • 标题:< HTTP/1.1 404 Not Found < Cache-Control: private < Transfer-Encoding: chunked < Content-Type: application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=false;charset=utf-8 < Server: Microsoft-IIS/8.5 < Set-Cookie: exchangecookie=c7fc4cb01bfb41c884b7d6f219181e01; expires=Fri, 27-Apr-2018 17:58:51 GMT; path=/; HttpOnly < request-id: e98a3488-3441-474c-8cff-c905f8b9f299
  • 标头++:< X-CalculatedFETarget: MWHPR1301CU001.internal.outlook.com < X-BackEndHttpStatus: 404 < X-FEProxyInfo: MWHPR1301CA0012.NAMPRD13.PROD.OUTLOOK.COM < X-CalculatedBETarget: MWHPR16MB1661.namprd16.prod.outlook.com < X-BackEndHttpStatus: 404 < OData-Version: 4.0 < X-AspNet-Version: 4.0.30319 < X-DiagInfo: MWHPR16MB1661 < X-BEServer: MWHPR16MB1661 < X-FEServer: MWHPR1301CA0012 < X-Powered-By: ASP.NET < X-FEServer: BY2PR02CA0116 < X-MSEdge-Ref: Ref A: 0872CED88164470BA7F119058A1F5CBF Ref B: BAYEDGE0318 Ref C: Thu Apr 27 10:58:51 2017 PST < Date: Thu, 27 Apr 2017 17:58:51 GMT

标签: directory office365api outlook-restapi


【解决方案1】:

我们认为这是由于缺少文件夹上的容器类属性设置不正确造成的,这可能是在 IMAP 迁移(从 IMAP 邮件系统迁移到 Office 365)期间造成的。容器类设置为IPF.Imap,而不是预期的IPF.Note

要显示这些文件夹,您可以使用 MFCMapi 或 EWS 编辑器更改容器类。这里有使用 MFCMapi 的说明:

https://support.microsoft.com/en-us/help/3050475/you-can-t-view-mailbox-folders-on-an-exchange-activesync-or-outlook-client-after-an-imap-migration

【讨论】:

  • 感谢您的更新。我会尝试让我们的客户执行这些操作。我会及时通知你。
  • 我们的客户使用该技巧更改收件箱文件夹的设置,该文件夹现在由 /me/MailFolders API 调用返回。我们正在检查其他文件夹。
【解决方案2】:

我遇到了同样的问题。我通过首先获取文件夹的 count 来解决它,然后使用 $top 过滤器发出第二个请求以获取我的所有文件夹。请看以下代码:

$http.get("https://outlook.office.com/api/v2.0/me/MailFolders/$count")
         .then(function(response) {
            //RETRIEVE ALL FOLDERS
            $http.get("https://outlook.office.com/api/v2.0/me/MailFolders?$top="+response.data).then(...)

【讨论】:

  • 嗨 AidaNow,不幸的是它没有帮助。我得到的计数是 9,它已经是我获取它们时得到的文件夹数。所以我没有得到丢失的。
  • 我明白了。你看过这个问答吗? stackoverflow.com/questions/35398770/…
  • 是的,我看到了那个问答。但是缺少的文件夹之一是收件箱,所以我猜它不是从外部应用程序创建的。
猜你喜欢
  • 2015-11-18
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-10-23
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多