reportRoot: getMailboxUsageMailboxCounts

Namespace: microsoft.graph

Important

APIs under the /beta version in Microsoft Graph are subject to change. Use of these APIs in production applications is not supported. To determine whether an API is available in v1.0, use the Version selector.

Get the total number of user mailboxes in your organization and how many are active each day of the reporting period. A mailbox is considered active if the user sent or read any email.

Note: For details about different report views and names, see Microsoft 365 reports - Mailbox usage.

This API is available in the following national cloud deployments.

Global service US Government L4 US Government L5 (DOD) China operated by 21Vianet

Permissions

Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions only if your app requires it. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference.

Permission type Least privileged permissions Higher privileged permissions
Delegated (work or school account) Reports.Read.All Not available.
Delegated (personal Microsoft account) Not supported. Not supported.
Application Reports.Read.All Not available.

Note: For delegated permissions to allow apps to read service usage reports on behalf of a user, the tenant administrator must have assigned the user the appropriate Microsoft Entra ID limited administrator role. For more details, see Authorization for APIs to read Microsoft 365 usage reports.

HTTP request

GET /reports/getMailboxUsageMailboxCounts(period='{period_value}')

Function parameters

In the request URL, provide the following parameter with a valid value.

Parameter Type Description
period string Specifies the length of time over which the report is aggregated. The supported values for {period_value} are: D7, D30, D90, and D180. These values follow the format Dn where n represents the number of days over which the report is aggregated. Required.

This method supports the $format OData query parameter to customize the response. The default output type is text/csv. However, if you want to specify the output type, you can use the OData $format query parameter set to text/csv or application/json.

Request headers

Name Description
Authorization Bearer {token}. Required. Learn more about authentication and authorization.

Response

CSV

If successful, this method returns a 302 Found response that redirects to a preauthenticated download URL for the report. That URL can be found in the Location header in the response.

Preauthenticated download URLs are only valid for a short period of time (a few minutes) and do not require an Authorization header.

The CSV file has the following headers for columns.

  • Report Refresh Date
  • Total
  • Active
  • Report Date
  • Report Period

JSON

If successful, this method returns a 200 OK response code and a JSON object in the response body.

Example

CSV

The following is an example that outputs CSV.

Request

The following example shows a request.

GET https://graph.microsoft.com/beta/reports/getMailboxUsageMailboxCounts(period='D7')?$format=text/csv

Response

The following example shows the response.

HTTP/1.1 302 Found
Content-Type: text/plain
Location: https://reports.office.com/data/download/JDFKdf2_eJXKS034dbc7e0t__XDe

Follow the 302 redirection and the CSV file that downloads will have the following schema.

HTTP/1.1 200 OK
Content-Type: application/octet-stream

Report Refresh Date,Total,Active,Report Date,Report Period

JSON

The following is an example that returns JSON.

Request

The following example shows a request.

GET https://graph.microsoft.com/beta/reports/getMailboxUsageMailboxCounts(period='D7')?$format=application/json

Response

The following example shows the response.

Note: The response object shown here might be shortened for readability.

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 232

{
  "value": [
    {
      "reportRefreshDate": "2017-09-01", 
      "total": 202, 
      "active": 198, 
      "reportDate": "2017-09-01", 
      "reportPeriod": "7"
    }
  ]
}