Ricardo de Vries
Ricardo de Vries

Reputation: 321

Where to find the folderId of a mail folder from Outlook

I need the folder ID of a folder of a mail account we use to fetch emails from programmatically. Now we use the Graph API and only want emails from a specific folder. I tried some settings in Outlook but couldn't find it. Also when I open Outlook in the browser I can't find it.

Now I've tried the Graph API Explorer, but I don't have sufficient permissions to get data from the mail account due to corporate bla bla.

Anyone have a golden tip?

Upvotes: 1

Views: 8595

Answers (1)

user2250152
user2250152

Reputation: 20778

Not sure which endpoint have you tried but when you call one of the following endpoints

GET https://graph.microsoft.com/v1.0/me/mailFolders
GET https://graph.microsoft.com/v1.0/users/{id | userPrincipalName}/mailFolders

Endpoint returns a collection of mailFolder including folder id

You can filter the specific folder by its displayName

GET https://graph.microsoft.com/v1.0/me/mailFolders?$filter=displayName eq '{folder_name}'

If you need list child folder you can call this endpoint:

GET https://graph.microsoft.com/v1.0/me/mailFolders/{folder_id}/childFolders

Upvotes: -1

Related Questions