Obtenha a coleção de pastas sob a pasta especificada. Você pode usar o atalho .../me/mailFolders para obter a coleção de pastas de nível superior e navegar até outra pasta.
Por padrão, esta operação não retorna pastas ocultas. Use um parâmetro de consulta includeHiddenFolders para incluí-los na resposta.
Escolha a permissão ou permissões marcadas como menos privilegiadas para esta API. Utilize uma permissão ou permissões com privilégios mais elevados apenas se a sua aplicação o exigir. Para obter detalhes sobre as permissões delegadas e de aplicação, veja Tipos de permissão. Para saber mais sobre estas permissões, veja a referência de permissões.
Tipo de permissão
Permissões com menos privilégios
Permissões com privilégios superiores
Delegado (conta corporativa ou de estudante)
Mail.ReadBasic
Mail.ReadWrite, Mail.Read
Delegado (conta pessoal da Microsoft)
Mail.ReadBasic
Mail.ReadWrite, Mail.Read
Application
Mail.ReadBasic.All
Mail.ReadWrite, Mail.Read
Solicitação HTTP
Para obter todas as pastas filho na pasta especificada, excluindo aquelas que estão ocultas:
GET /me/mailFolders/{id}/childFolders
GET /users/{id | userPrincipalName}/mailFolders/{id}/childFolders
Para incluir pastas filho ocultas na resposta:
GET /me/mailFolders/{id}/childFolders?includeHiddenFolders=true
GET /users/{id | userPrincipalName}/mailFolders/{id}/childFolders?includeHiddenFolders=true
Parâmetros de consulta opcionais
Para retornar uma lista de todas as childFolders incluindo aquelas que estão ocultas (sua propriedade isHidden é verdadeira), no URL de solicitação, especifique o includeHiddenFolders parâmetro de consulta como true, conforme mostrado na seção de solicitação HTTP.
GET https://graph.microsoft.com/v1.0/me/mailFolders/AAMkAGVmMDEzMTM4LTZmYWUtNDdkNC1hMDZiLTU1OGY5OTZhYmY4OAAuAAAAAAAiQ8W967B7TKBjgx9rVEURAQAiIsqMbYjsT5e-T7KzowPTAAAAAAFNAAA=/childFolders
// Code snippets are only available for the latest version. Current version is 5.x
// To initialize your graphClient, see https://video2.skills-academy.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Me.MailFolders["{mailFolder-id}"].ChildFolders.GetAsync();
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
//other-imports
)
// To initialize your graphClient, see https://video2.skills-academy.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
childFolders, err := graphClient.Me().MailFolders().ByMailFolderId("mailFolder-id").ChildFolders().Get(context.Background(), nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
MailFolderCollectionResponse result = graphClient.me().mailFolders().byMailFolderId("{mailFolder-id}").childFolders().get();
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
# To initialize your graph_client, see https://video2.skills-academy.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
result = await graph_client.me.mail_folders.by_mail_folder_id('mailFolder-id').child_folders.get()
Exemplo 2: Incluir pastas filho ocultas em uma pasta de email especificada
O próximo exemplo usa o parâmetro de consulta includeHiddenFolders para obter uma lista de pastas filho em uma pasta de email especificada, incluindo pastas de email ocultas. A resposta inclui a pasta "Emails secundários" que tem a isHidden definida como verdadeira.
GET https://graph.microsoft.com/v1.0/me/mailFolders/AAMkAGVmMDEzMTM4LTZmYWUtNDdkNC1hMDZiLTU1OGY5OTZhYmY4OAAuAAAAAAAiQ8W967B7TKBjgx9rVEURAQAiIsqMbYjsT5e-T7KzowPTAAAAAAFNAAA=/childFolders?includeHiddenFolders=true
// Code snippets are only available for the latest version. Current version is 5.x
// To initialize your graphClient, see https://video2.skills-academy.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Me.MailFolders["{mailFolder-id}"].ChildFolders.GetAsync((requestConfiguration) =>
{
requestConfiguration.QueryParameters.IncludeHiddenFolders = "true";
});
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphusers "github.com/microsoftgraph/msgraph-sdk-go/users"
//other-imports
)
requestIncludeHiddenFolders := "true"
requestParameters := &graphusers.ItemMailFolderItemChildFoldersRequestBuilderGetQueryParameters{
IncludeHiddenFolders: &requestIncludeHiddenFolders,
}
configuration := &graphusers.ItemMailFolderItemChildFoldersRequestBuilderGetRequestConfiguration{
QueryParameters: requestParameters,
}
// To initialize your graphClient, see https://video2.skills-academy.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
childFolders, err := graphClient.Me().MailFolders().ByMailFolderId("mailFolder-id").ChildFolders().Get(context.Background(), configuration)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
MailFolderCollectionResponse result = graphClient.me().mailFolders().byMailFolderId("{mailFolder-id}").childFolders().get(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
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.users.item.mail_folders.item.child_folders.child_folders_request_builder import ChildFoldersRequestBuilder
from kiota_abstractions.base_request_configuration import RequestConfiguration
# To initialize your graph_client, see https://video2.skills-academy.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
query_params = ChildFoldersRequestBuilder.ChildFoldersRequestBuilderGetQueryParameters(
include_hidden_folders = "true",
)
request_configuration = RequestConfiguration(
query_parameters = query_params,
)
result = await graph_client.me.mail_folders.by_mail_folder_id('mailFolder-id').child_folders.get(request_configuration = request_configuration)