Create mailbox folder with Graph API

ort_tt 21 Reputation points

I want to use the Graph API to create a folder in a mailbox that belongs to Exchange Online.
After getting the token, I was able to create a folder with the following command.
However, it cannot be created as a child folder of the specified folder.
Is it possible to create directly under the inbox?

$url = " .com/mailFolders/inbox"
$Body = @"
"displayName": "TestFolder",
"parentFolderId": "**********"

Invoke-RestMethod -Uri $url -Method Post -Body $Body -ContentType 'application/json; charset=utf-8' -Headers $headerParams | ConvertTo-Json

Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
20,587 questions
0 comments No comments
{count} votes

Accepted answer
  1. soumi-MSFT 11,766 Reputation points Microsoft Employee

    @ort_tt , I just tested this api and it worked for me. Let me share the detailed steps below:

    1. Use Authorization Code Grant Flow to fetch a token for your App from AAD.
    2. Once you have the code use it to request for an access_token from AAD. make sure the following delegated permission "Mail.ReadWrite" is present on the app registration that is being used here.
    3. Call the following Graph API.



    "displayName": "{Child Folder Name}",

    This is the ID for my inbox "AAMkADAwZmE5NGU1LWJlYzAtNGE0ZS1hZDI4LWZmNmU0MDdjNzgyZQAuAAAAAABh0v7KYQaiRob9eDRfUq1JAQDBRn5LIsmdTKmOCwZeGkgvAAAAAAEMAAA="

    Once you make the api call, you should get status 200 OK and the child folder should be present in your outlook:


    Hope this helps.

    Do let us know if this helps and if there are any more queries around this, please do let us know so that we can help you further. Also, please do not forget to accept the response as Answer; if the above response helped in answering your query.

0 additional answers

Sort by: Most helpful