Outlook REST API - getFolders 不返回所有文件夹 [英] Outlook REST API - getFolders not returning all folders

查看:41
本文介绍了Outlook REST API - getFolders 不返回所有文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚开始使用 Outlook REST API.我的基线是使用 node-outlook 的教程.

I'm just getting started with the Outlook REST API. My baseline is the tutorial that uses node-outlook.

首要任务是检索我邮件帐户中的所有文件夹.

First order of business is to retrieve all of the folders in my mail account.

所以我发出这个 REST 请求:

So I issue this REST request:

GET https://outlook.office.com/api/v2.0/Me/MailFolders

它不会返回我的所有文件夹,而是只返回众所周知的"文件夹.文件夹:

Instead of returning all of my folders, it only returns the "well known" folders:

Clutter
Deleted Items
Drafts
Inbox
Junk Email
Outbox
Sent Items
Trash

我是不是遗漏了一个查询参数,或者说不,真的,所有人都请"?

Am I missing a query parameter or something that says, "no, really, all of them please"?

我尝试了一个不同的电子邮件帐户,我也没有得到我所有的实际文件夹,但我得到了一个不同的子集(其中一些是众所周知的,其他的不是).

I tried a different email account, and I also don't get all of my actual folders, but I get a different subset (some of which are well-known, others aren't).

我正在实施分页协议(使用@nextLink 参数),因此这与页面大小无关.我在一个帐户上收到这 8 个文件夹,在另一个帐户上收到 18 个文件夹.

I am implementing the paging protocol (using the @nextLink parameter) so it's not a matter of page sizes. I am getting these 8 folders on one account, and 18 folders on another.

所以必须有一些东西来决定哪些文件夹将被返回.

So there must be something that decides what folders will be returned.

我改为使用测试版"进行文件夹同步应用程序接口.在这种情况下,我还会在列表中得到一个未命名的文件夹,它是其他文件夹的父文件夹.它带有一个准确的 ChildFolderCount.但是,当我对该文件夹 ID 执行子文件夹请求时,我得到了相同的列表.

I changed to doing a folder sync instead using the "beta" API. In this case, I also get an unnamed folder in the list, which is the parent of the other folders. It comes along with a ChildFolderCount which is accurate. However, when I do a child folder request on that folder id I get the same list.

这是我在尝试读取返回一个非零 ChildFolderCount 的文件夹的子文件夹时使用的请求 url.

Here's the request url I'm using when I attempt to read the child folders of the one folder that comes back with a non-zero ChildFolderCount.

GET https://outlook.office.com/api/beta/Me/MailFolders/AAMkADRmMzFmNjZmLWU3MjctNGZiNi1iZTg4LTRmNGQwYTVhMDgxYgAuAAAAAAB8IxaZ5KGbQom4EPywGCSdAQDVy0eYwAzLS63k5pohzykCAAAAAAEJAAA=/childfolders

推荐答案

以下内容似乎定义了此 API 返回哪些文件夹,哪些不是:

Here's what appears to define what folders are returned by this API and what are not:

  • 如果我直接在 Outlook Webmail 上在 office365 中创建一个文件夹,它会显示在此查询中.

  • If I create a folder in office365 directly on outlook webmail, it shows up in this query.

如果我在 Mac Mail 中创建文件夹,则不会.

If I create a folder in Mac Mail, it does not.

Mac Mail 使用 EWS 访问该服务,因此我希望它创建的文件夹与任何其他文件夹一样.

Mac Mail accesses the service using EWS, so I would expect a folder created by it would be like any other folder.

因此,在 Mac Mail 上创建的文件夹存在一些问题,阻止它们被此 API 返回.

So there is something about folders created on Mac Mail that prevents them from being returned by this API.

在 Mac Mail 中创建的文件夹会显示在网络邮件中,反之亦然.

Folders created in Mac Mail DO show up in web mail and vice versa.

在 iPhone 上创建的文件夹会显示出来,因此在我有限的测试中,Mac Mail 可能是唯一遇到此问题的应用程序.我的问题是我的大部分文件夹都是在 Mac Mail 中创建的,我没有简单的方法来重建它们.

Folders created on an iPhone DO show up, so in my limited testing it looks like Mac Mail may be the only app suffering from this problem. The problem I have is most of my folders were created in Mac Mail and I have no easy way of rebuilding them.

我认为这只是 API 中的一个 BUG.无论如何,这回答了我最初的问题,应该可以帮助任何尝试使用新 API 的人.

I'm thinking this is just a BUG in the API. At any rate, this answers my original question and should help anyone out there trying to use the new API.

如果我找到解决方法,我会在这里发布.

If I find a workaround I'll post it here.

这篇关于Outlook REST API - getFolders 不返回所有文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆