简体   繁体   中英

Outlook REST API - getFolders not returning all folders

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.

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

UPDATE

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).

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.

UPDATE 2

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.

UPDATE 3

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

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

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

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

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

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

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

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM