List mailFolders

Important

APIs under the /beta version in Microsoft Graph are subject to change. Use of these APIs in production applications is not supported.

Get all the mail folders in the signed-in user's mailbox.

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.Read, Mail.ReadWrite
Delegated (personal Microsoft account) Mail.Read, Mail.ReadWrite
Application Mail.Read, Mail.ReadWrite

HTTP request

GET /me/mailFolders
GET /users/{id | userPrincipalName}/mailFolders

Optional query parameters

This method supports the OData Query Parameters to help customize the response.

Request headers

Header Value
Authorization Bearer {token}. Required.
Content-Type application/json

Request body

Do not supply a request body for this method.

Response

If successful, this method returns a 200 OK response code and collection of MailFolder objects in the response body.

Example

Request

Here is an example of the request.

GET https://graph.microsoft.com/beta/me/mailFolders
Response

Here is an example of the response. Note: The response object shown here may be truncated for brevity. All of the properties will be returned from an actual call.

HTTP/1.1 200 OK
Content-type: application/json
Content-length: 232

{
  "value": [
    {
      "displayName": "displayName-value",
      "parentFolderId": "parentFolderId-value",
      "childFolderCount": 99,
      "unreadItemCount": 99,
      "totalItemCount": 99,
      "id": "id-value"
    }
  ]
}

SDK sample code


GraphServiceClient graphClient = new GraphServiceClient( authProvider );

var mailFolders = await graphClient.Me.MailFolders
	.Request()
	.GetAsync();

Read the SDK documentation for details on how to add the SDK to your project and create an authProvider instance.