reportRoot: getM365AppUserDetail
本文内容
命名空间:microsoft.graph
重要
Microsoft Graph /beta
版本下的 API 可能会发生更改。 不支持在生产应用程序中使用这些 API。 若要确定 API 是否在 v1.0 中可用,请使用 版本 选择器。
获取一个报告,其中提供了有关用户使用的应用和平台的详细信息。
注意: 有关不同报表视图和名称的详细信息,请参阅管理中心中的 Microsoft 365 报表 - Microsoft 365 应用版使用情况 。
此 API 可用于以下国家级云部署 。
全局服务
美国政府 L4
美国政府 L5 (DOD)
由世纪互联运营的中国
✅
✅
✅
✅
权限
为此 API 选择标记为最低特权的权限。 只有在应用需要它时 ,才使用更高的特权权限。 有关委派权限和应用程序权限的详细信息,请参阅权限类型 。 要了解有关这些权限的详细信息,请参阅 权限参考 。
权限类型
最低特权权限
更高特权权限
委派(工作或学校帐户)
Reports.Read.All
不可用。
委派(个人 Microsoft 帐户)
不支持。
不支持。
应用
Reports.Read.All
不可用。
注意: 要使委托权限允许应用代表用户读取服务使用情况报告,租户管理员必须向用户分配适当的Microsoft Entra ID受限管理员角色。 有关更多详细信息,请参阅授权 API 读取 Microsoft 365 使用情况报告 。
HTTP 请求
GET /reports/getM365AppUserDetail(period='{period_value}')
GET /reports/getM365AppUserDetail(date='{date_value}')
函数参数
在请求 URL 中,为以下参数提供有效值。
参数
类型
说明
period
string
指定在多长时间内聚合报表。 {period_value} 支持的值为: D7
、 D30
、 D90
和 D180
。 这些值采用格式 Dn ,其中 n 表示在多少天内聚合报表。
date
Date
指定要查看用户在哪个日期执行的任何活动。 {date_value} 必须采用格式 YYYY-MM-DD。 因为此报表的有效期仅为过去 30 天,所以 {date_value} 应为这个范围内的日期。
注意: 需要在请求 URL 中设置 句点 或 日期 。
可选的查询参数
此方法支持 $format
、 $top
和 $skipToken
OData 查询参数 来自定义响应。 默认输出类型为 text/csv
。 但是,如果要指定输出类型,可以使用 OData $format
查询参数将默认输出设置为 text/csv
或 application/json
。
名称
说明
Authorization
持有者 {token}。 必填。 详细了解 身份验证和授权 。
请求正文
请勿为此方法提供请求正文。
响应
CSV
如果成功,此方法返回 302 Found
响应,以重定向到报表的预先验证的下载 URL。 可以在响应的 Location
头中找到此 URL。
预先验证的下载 URL 的有效时间很短(几分钟),不需要 Authorization
标头。
CSV 文件包含下面的列标题:
报表刷新日期
用户主体名称
上次激活日期
上次活动日期
报表周期
Windows
Mac
移动设备
Web
Outlook
Word
Excel
PowerPoint
OneNote
Teams
Outlook (Windows)
Word (Windows)
Excel (Windows)
PowerPoint (Windows)
OneNote (Windows)
Teams (Windows)
Outlook (Mac)
Word (Mac)
Excel (Mac)
PowerPoint (Mac)
OneNote (Mac)
Teams (Mac)
Outlook (Mobile)
Word (移动)
Excel (Mobile)
PowerPoint (Mobile)
OneNote (Mobile)
Teams (Mobile)
Outlook (Web)
Word (Web)
Excel (Web)
PowerPoint (Web)
OneNote (Web)
Teams (Web)
JSON
如果成功,此方法在 200 OK
响应正文中返回响应代码和 JSON 对象。
此请求的默认页面大小为 200 个项目。
示例
示例 1:CSV 输出
下面是输出 CSV 的示例。
请求
以下示例显示了一个请求。
GET https://graph.microsoft.com/beta/reports/getM365AppUserDetail(period='D7')?$format=text/csv
// Code snippets are only available for the latest version. Current version is 5.x
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
await graphClient.Reports.GetM365AppUserDetailWithPeriod("{period}").GetAsync((requestConfiguration) =>
{
requestConfiguration.QueryParameters.Format = "text/csv";
});
// THE CLI IS IN PREVIEW. NON-PRODUCTION USE ONLY
mgc-beta reports get-m365-app-user-detail-with-period get --period {period-id}
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
graphreports "github.com/microsoftgraph/msgraph-beta-sdk-go/reports"
//other-imports
)
graphClient := msgraphsdk.NewGraphServiceClientWithCredentials(cred, scopes)
requestFormat := "text/csv"
requestParameters := &graphreports.ReportsGetM365AppUserDetail(period='{period}')RequestBuilderGetQueryParameters{
Format: &requestFormat,
}
configuration := &graphreports.ReportsGetM365AppUserDetail(period='{period}')RequestBuilderGetRequestConfiguration{
QueryParameters: requestParameters,
}
period := "{period}"
graphClient.Reports().GetM365AppUserDetailWithPeriod(&period).Get(context.Background(), configuration)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
graphClient.reports().getM365AppUserDetailWithPeriod("{period}").get(requestConfiguration -> {
requestConfiguration.queryParameters.format = "text/csv";
});
const options = {
authProvider,
};
const client = Client.init(options);
let stream = await client.api('/reports/getM365AppUserDetail(period='D7')')
.version('beta')
.get();
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Reports\GetM365AppUserDetail(period='{period}')\GetM365AppUserDetailWithPeriodRequestBuilderGetRequestConfiguration;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestConfiguration = new GetM365AppUserDetailWithPeriodRequestBuilderGetRequestConfiguration();
$queryParameters = GetM365AppUserDetailWithPeriodRequestBuilderGetRequestConfiguration::createQueryParameters();
$queryParameters->format = "text/csv";
$requestConfiguration->queryParameters = $queryParameters;
$graphServiceClient->reports()->getM365AppUserDetailWithPeriod('{period}', )->get($requestConfiguration)->wait();
from msgraph import GraphServiceClient
from msgraph.generated.reports.get_m365_app_user_detail(period='{period}').get_m365_app_user_detail_with_period_request_builder import GetM365AppUserDetailWithPeriodRequestBuilder
graph_client = GraphServiceClient(credentials, scopes)
query_params = GetM365AppUserDetailWithPeriodRequestBuilder.GetM365AppUserDetailWithPeriodRequestBuilderGetQueryParameters(
format = "text/csv",
)
request_configuration = GetM365AppUserDetailWithPeriodRequestBuilder.GetM365AppUserDetailWithPeriodRequestBuilderGetRequestConfiguration(
query_parameters = query_params,
)
await graph_client.reports.get_m365_app_user_detail_with_period("{period}").get(request_configuration = request_configuration)
响应
以下示例显示了相应的响应。
HTTP/1.1 302 Found
Content-Type: text/plain
Location: https://reports.office.com/data/download/JDFKdf2_eJXKS034dbc7e0t__XDe
执行 302 重定向,下载的 CSV 文件将采用以下架构。
HTTP/1.1 200 OK
Content-Type: application/octet-stream
Report Refresh Date,User Principal Name,Last Activation Date,Last Activity Date,Report Period,Windows,Mac,Mobile,Web,Outlook,Word,Excel,PowerPoint,OneNote,Teams,Outlook (Windows),Word (Windows),Excel (Windows),PowerPoint (Windows),OneNote (Windows),Teams (Windows),Outlook (Mac),Word (Mac),Excel (Mac),PowerPoint (Mac),OneNote (Mac),Teams (Mac),Outlook (Mobile),Word (Mobile),Excel (Mobile),PowerPoint (Mobile),OneNote (Mobile),Teams (Mobile),Outlook (Web),Word (Web),Excel (Web),PowerPoint (Web),OneNote (Web),Teams (Web)
示例 2:JSON 输出
下面是返回 JSON 的示例。
请求
以下示例显示了一个请求。
GET https://graph.microsoft.com/beta/reports/getM365AppUserDetail(period='D7')?$format=application/json
// Code snippets are only available for the latest version. Current version is 5.x
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
await graphClient.Reports.GetM365AppUserDetailWithPeriod("{period}").GetAsync((requestConfiguration) =>
{
requestConfiguration.QueryParameters.Format = "application/json";
});
// THE CLI IS IN PREVIEW. NON-PRODUCTION USE ONLY
mgc-beta reports get-m365-app-user-detail-with-period get --period {period-id}
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
graphreports "github.com/microsoftgraph/msgraph-beta-sdk-go/reports"
//other-imports
)
graphClient := msgraphsdk.NewGraphServiceClientWithCredentials(cred, scopes)
requestFormat := "application/json"
requestParameters := &graphreports.ReportsGetM365AppUserDetail(period='{period}')RequestBuilderGetQueryParameters{
Format: &requestFormat,
}
configuration := &graphreports.ReportsGetM365AppUserDetail(period='{period}')RequestBuilderGetRequestConfiguration{
QueryParameters: requestParameters,
}
period := "{period}"
graphClient.Reports().GetM365AppUserDetailWithPeriod(&period).Get(context.Background(), configuration)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
graphClient.reports().getM365AppUserDetailWithPeriod("{period}").get(requestConfiguration -> {
requestConfiguration.queryParameters.format = "application/json";
});
const options = {
authProvider,
};
const client = Client.init(options);
let stream = await client.api('/reports/getM365AppUserDetail(period='D7')')
.version('beta')
.get();
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Reports\GetM365AppUserDetail(period='{period}')\GetM365AppUserDetailWithPeriodRequestBuilderGetRequestConfiguration;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestConfiguration = new GetM365AppUserDetailWithPeriodRequestBuilderGetRequestConfiguration();
$queryParameters = GetM365AppUserDetailWithPeriodRequestBuilderGetRequestConfiguration::createQueryParameters();
$queryParameters->format = "application/json";
$requestConfiguration->queryParameters = $queryParameters;
$graphServiceClient->reports()->getM365AppUserDetailWithPeriod('{period}', )->get($requestConfiguration)->wait();
from msgraph import GraphServiceClient
from msgraph.generated.reports.get_m365_app_user_detail(period='{period}').get_m365_app_user_detail_with_period_request_builder import GetM365AppUserDetailWithPeriodRequestBuilder
graph_client = GraphServiceClient(credentials, scopes)
query_params = GetM365AppUserDetailWithPeriodRequestBuilder.GetM365AppUserDetailWithPeriodRequestBuilderGetQueryParameters(
format = "application/json",
)
request_configuration = GetM365AppUserDetailWithPeriodRequestBuilder.GetM365AppUserDetailWithPeriodRequestBuilderGetRequestConfiguration(
query_parameters = query_params,
)
await graph_client.reports.get_m365_app_user_detail_with_period("{period}").get(request_configuration = request_configuration)
响应
以下示例显示了相应的响应。
注意: 为了提高可读性,可能缩短了此处显示的响应对象。
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 951
{
"@odata.nextLink": "https://graph.microsoft.com/beta/reports/getM365AppUserDetail(period='D7')?$format=application/json&$skiptoken=AAAAA",
"value": [
{
"reportRefreshDate": "2020-06-30",
"userPrincipalName": "admin@contoso.com",
"lastActivationDate": "2020-05-22",
"lastActivityDate": "2020-06-30",
"details": [
{
"reportPeriod": 7,
"windows": true,
"mac": false,
"mobile": true,
"web": false,
"outlook": false,
"word": false,
"excel": false,
"powerPoint": false,
"oneNote": false,
"teams": true,
"outlookWindows": false,
"wordWindows": false,
"excelWindows": false,
"powerPointWindows": false,
"oneNoteWindows": false,
"teamsWindows": true,
"outlookMac": false,
"wordMac": false,
"excelMac": false,
"powerPointMac": false,
"oneNoteMac": false,
"teamsMac": false,
"outlookMobile": false,
"wordMobile": false,
"excelMobile": false,
"powerPointMobile": false,
"oneNoteMobile": false,
"teamsMobile": true,
"outlookWeb": false,
"wordWeb": false,
"excelWeb": false,
"powerPointWeb": false,
"oneNoteWeb": false,
"teamsWeb": true
}
]
}
]
}