命名空间:microsoft.graph
更新隐私设置以在组织中显示或返回指定类型的见解。 目前, itemInsights 是唯一受支持的设置类型。
若要详细了解如何为组织自定义见解隐私,请参阅 在 Microsoft Graph 中自定义项见解隐私。
此 API 可用于以下国家级云部署。
全局服务 |
美国政府 L4 |
美国政府 L5 (DOD) |
由世纪互联运营的中国 |
✅ |
✅ |
✅ |
✅ |
权限
下表显示了对每种受支持的资源类型调用此 API 所需的最低特权权限。 请遵循 最佳做法 来请求最低特权权限。 有关委派权限和应用程序权限的详细信息,请参阅权限类型。 要了解有关这些权限的详细信息,请参阅 权限参考。
更新组织的 itemInsights 设置
权限类型 |
最低特权权限 |
更高特权权限 |
委派(工作或学校帐户) |
PeopleSettings.ReadWrite.All |
不可用。 |
委派(个人 Microsoft 帐户) |
不支持。 |
不支持。 |
应用程序 |
PeopleSettings.ReadWrite.All |
不可用。 |
注意: 使用此操作的委托权限更新项见解要求已登录用户具有全局管理员角色。
HTTP 请求
若要更新项见解的设置,请执行以下操作:
PATCH /admin/people/itemInsights
标头 |
值 |
Authorization |
持有者 {token}。 必填。 详细了解 身份验证和授权。 |
Content-Type |
application/json. 必需。 |
请求正文
在请求正文中, 仅 提供要更新的属性的值。 请求正文中未包含的现有属性会保留其以前的值,或者根据对其他属性值的更改重新计算。
下表指定可更新的属性。
属性 |
类型 |
说明 |
disabledForGroup |
String |
Microsoft Entra组的 ID,其成员禁用其指定类型的见解。 默认值为“empty ”。 可选。 |
isEnabledInOrganization |
布尔值 |
true 如果为组织启用了指定的见解类型,则为 ; false 如果为所有用户禁用指定的见解类型,则无异常。 默认值为 true 。 可选。 |
注意: 如果在请求正文中包含 disabledForGroup 属性值,此操作不会验证该值。 如果将 disabledForGroup 属性设置为 String,此操作不会检查相应的Microsoft Entra组的存在。 这意味着,如果将 disabledForGroup 设置为不存在或随后被删除的Microsoft Entra组,则此操作无法识别任何组成员身份并禁用任何特定用户的项见解。 如果 isEnabledInOrganization 设置为 true
,则操作为组织中的 所有用户 启用指定类型的见解。
响应
如果成功,此方法在响应正文中返回响应 200 OK
代码和 insightsSettings 对象。
示例
请求
以下示例演示管理员如何更新 disabledForGroup 隐私设置,以防止显示特定Microsoft Entra组中用户的项目见解。
PATCH https://graph.microsoft.com/v1.0/admin/people/itemInsights
Content-Type: application/json
{
"disabledForGroup": "edbfe4fb-ec70-4300-928f-dbb2ae86c981"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new InsightsSettings
{
DisabledForGroup = "edbfe4fb-ec70-4300-928f-dbb2ae86c981",
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Admin.People.ItemInsights.PatchAsync(requestBody);
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
mgc admin people item-insights patch --body '{\
"disabledForGroup": "edbfe4fb-ec70-4300-928f-dbb2ae86c981"\
}\
'
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
// 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"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewInsightsSettings()
disabledForGroup := "edbfe4fb-ec70-4300-928f-dbb2ae86c981"
requestBody.SetDisabledForGroup(&disabledForGroup)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
itemInsights, err := graphClient.Admin().People().ItemInsights().Patch(context.Background(), requestBody, nil)
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
InsightsSettings insightsSettings = new InsightsSettings();
insightsSettings.setDisabledForGroup("edbfe4fb-ec70-4300-928f-dbb2ae86c981");
InsightsSettings result = graphClient.admin().people().itemInsights().patch(insightsSettings);
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
const options = {
authProvider,
};
const client = Client.init(options);
const insightsSettings = {
disabledForGroup: 'edbfe4fb-ec70-4300-928f-dbb2ae86c981'
};
await client.api('/admin/people/itemInsights')
.update(insightsSettings);
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\InsightsSettings;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new InsightsSettings();
$requestBody->setDisabledForGroup('edbfe4fb-ec70-4300-928f-dbb2ae86c981');
$result = $graphServiceClient->admin()->people()->itemInsights()->patch($requestBody)->wait();
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
Import-Module Microsoft.Graph.Identity.DirectoryManagement
$params = @{
disabledForGroup = "edbfe4fb-ec70-4300-928f-dbb2ae86c981"
}
Update-MgAdminPeopleItemInsight -BodyParameter $params
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.models.insights_settings import InsightsSettings
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = InsightsSettings(
disabled_for_group = "edbfe4fb-ec70-4300-928f-dbb2ae86c981",
)
result = await graph_client.admin.people.item_insights.patch(request_body)
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
响应
以下示例显示了相应的响应。
注意:为了提高可读性,可能缩短了此处显示的响应对象。
HTTP/1.1 200 OK
Content-type: application/json
{
"disabledForGroup": "edbfe4fb-ec70-4300-928f-dbb2ae86c981"
}