Get the folder collection under the specified folder. You can use the .../me/mailFolders shortcut to get the top-level
folder collection and navigate to another folder.
By default, this operation does not return hidden folders. Use a query parameter includeHiddenFolders to include them in the response.
Permissions
One of the following permissions is required to call this API. To learn more, including how to choose permissions, see Permissions.
Permission type
Permissions (from least to most privileged)
Delegated (work or school account)
Mail.ReadBasic, Mail.Read, Mail.ReadWrite
Delegated (personal Microsoft account)
Mail.ReadBasic, Mail.Read, Mail.ReadWrite
Application
Mail.ReadBasic.All, Mail.Read, Mail.ReadWrite
HTTP request
To get all the child folders under the specified folder, excluding those that are hidden:
GET /me/mailFolders/{id}/childFolders
GET /users/{id | userPrincipalName}/mailFolders/{id}/childFolders
To include hidden child folders in the response:
GET /me/mailFolders/{id}/childFolders?includeHiddenFolders=true
GET /users/{id | userPrincipalName}/mailFolders/{id}/childFolders?includeHiddenFolders=true
Optional query parameters
To return a list of all childFolders including those that are hidden (their isHidden property is true), in the request URL, specify the includeHiddenFolders query parameter as true, as shown in the HTTP request section.
GET https://graph.microsoft.com/v1.0/me/mailFolders/AAMkAGVmMDEzMTM4LTZmYWUtNDdkNC1hMDZiLTU1OGY5OTZhYmY4OAAuAAAAAAAiQ8W967B7TKBjgx9rVEURAQAiIsqMbYjsT5e-T7KzowPTAAAAAAFNAAA=/childFolders
var graphClient = new GraphServiceClient(requestAdapter);
var result = await graphClient.Me.MailFolders["{mailFolder-id}"].ChildFolders.GetAsync();
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClientWithCredentials(cred, scopes)
result, err := graphClient.Me().MailFoldersById("mailFolder-id").ChildFolders().Get(context.Background(), nil)
<?php
// THIS SNIPPET IS A PREVIEW FOR THE KIOTA BASED SDK. NON-PRODUCTION USE ONLY
$graphServiceClient = new GraphServiceClient($requestAdapter);
$requestResult = $graphServiceClient->me()->mailFoldersById('mailFolder-id')->childFolders()->get();
Example 2: Include hidden child folders under a specified mail folder
The next example uses the includeHiddenFolders query parameter to get a list of child folders under a specified mail folder including hidden mail folders. The response includes the "Clutters" folder that has the isHidden set to true.
GET https://graph.microsoft.com/v1.0/me/mailFolders/AAMkAGVmMDEzMTM4LTZmYWUtNDdkNC1hMDZiLTU1OGY5OTZhYmY4OAAuAAAAAAAiQ8W967B7TKBjgx9rVEURAQAiIsqMbYjsT5e-T7KzowPTAAAAAAFNAAA=/childFolders?includeHiddenFolders=true
var graphClient = new GraphServiceClient(requestAdapter);
var result = await graphClient.Me.MailFolders["{mailFolder-id}"].ChildFolders.GetAsync((requestConfiguration) =>
{
requestConfiguration.QueryParameters.Includehiddenfolders = true;
});
Import-Module Microsoft.Graph.Mail
# A UPN can also be used as -UserId.
Get-MgUserMailFolderChildFolder -UserId $userId -MailFolderId $mailFolderId -Includehiddenfolders true
<?php
// THIS SNIPPET IS A PREVIEW FOR THE KIOTA BASED SDK. NON-PRODUCTION USE ONLY
$graphServiceClient = new GraphServiceClient($requestAdapter);
$requestConfiguration = new ChildFoldersRequestBuilderGetRequestConfiguration();
$queryParameters = new ChildFoldersRequestBuilderGetQueryParameters();
$queryParameters->includehiddenfolders = true;
$requestConfiguration->queryParameters = $queryParameters;
$requestResult = $graphServiceClient->me()->mailFoldersById('mailFolder-id')->childFolders()->get($requestConfiguration);