For the default folders, you can use a "well-known name" (in this case inbox
) to get the correct id
. From the documentation:
Outlook creates certain folders for users by default. Instead of using the corresponding folder id value, for convenience, you can use
the following well-known folder names when accessing these folders in a mailFolder collection: ArchiveRoot
, ConversationHistory
, DeletedItems
,
Drafts
, Inbox
, JunkEmail
, Outbox
, and SentItems
.
To illustrate, calling /me/mailFolders/inbox
in the sample Graph Explorer tenant returns:
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('48d31887-5fad-4d73-a9f5-3c356e68a038')/mailFolders/$entity",
"id": "AAMkAGVmMDEzMTM4LTZmYWUtNDdkNC1hMDZiLTU1OGY5OTZhYmY4OAAuAAAAAAAiQ8W967B7TKBjgx9rVEURAQAiIsqMbYjsT5e-T7KzowPTAAAAAAEMAAA=",
"displayName": "Inbox",
"parentFolderId": "AAMkAGVmMDEzMTM4LTZmYWUtNDdkNC1hMDZiLTU1OGY5OTZhYmY4OAAuAAAAAAAiQ8W967B7TKBjgx9rVEURAQAiIsqMbYjsT5e-T7KzowPTAAAAAAEIAAA=",
"childFolderCount": 2,
"unreadItemCount": 59,
"totalItemCount": 60
}
/me/mailFolders/inbox?$select=id
. – Artemas