命名空间:microsoft.graph
注意:适用于 Intune 的 Microsoft Graph API 需要适用于租户的活动 Intune 许可证。
更新 notificationMessageTemplate 对象的属性。
此 API 可用于以下国家级云部署。
全局服务 |
美国政府 L4 |
美国政府 L5 (DOD) |
由世纪互联运营的中国 |
✅ |
✅ |
✅ |
✅ |
权限
要调用此 API,需要以下权限之一。 若要了解详细信息,包括如何选择权限的信息,请参阅权限。
权限类型 |
权限(从最低特权到最高特权) |
委派(工作或学校帐户) |
DeviceManagementServiceConfig.ReadWrite.All |
委派(个人 Microsoft 帐户) |
不支持。 |
应用程序 |
DeviceManagementServiceConfig.ReadWrite.All |
HTTP 请求
PATCH /deviceManagement/notificationMessageTemplates/{notificationMessageTemplateId}
标头 |
值 |
Authorization |
持有者 {token}。 必填。 详细了解 身份验证和授权。 |
接受 |
application/json |
请求正文
在请求正文中,提供 notificationMessageTemplate 对象的 JSON 表示形式。
下表显示创建 notificationMessageTemplate 时所需的属性。
属性 |
类型 |
说明 |
id |
String |
实体的键。 |
lastModifiedDateTime |
DateTimeOffset |
上次修改对象的日期/时间。 |
displayName |
String |
通知消息模板的显示名称。 |
defaultLocale |
String |
请求的区域设置不可用时要回退到的默认区域设置。 |
brandingOptions |
notificationTemplateBrandingOptions |
消息模板品牌选项。 已在 Intune 管理员控制台中定义品牌。 可取值为:none 、includeCompanyLogo 、includeCompanyName 、includeContactInformation 、includeCompanyPortalLink 、includeDeviceDetails 或 unknownFutureValue 。 |
roleScopeTagIds |
字符串集合 |
此实体实例的范围标记列表。 |
响应
如果成功,此方法在响应正文中返回 200 OK
响应代码和更新的 notificationMessageTemplate 对象。
示例
请求
下面是一个请求示例。
PATCH https://graph.microsoft.com/v1.0/deviceManagement/notificationMessageTemplates/{notificationMessageTemplateId}
Content-type: application/json
Content-length: 259
{
"@odata.type": "#microsoft.graph.notificationMessageTemplate",
"displayName": "Display Name value",
"defaultLocale": "Default Locale value",
"brandingOptions": "includeCompanyLogo",
"roleScopeTagIds": [
"Role Scope Tag Ids value"
]
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new NotificationMessageTemplate
{
OdataType = "#microsoft.graph.notificationMessageTemplate",
DisplayName = "Display Name value",
DefaultLocale = "Default Locale value",
BrandingOptions = NotificationTemplateBrandingOptions.IncludeCompanyLogo,
RoleScopeTagIds = new List<string>
{
"Role Scope Tag Ids value",
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.DeviceManagement.NotificationMessageTemplates["{notificationMessageTemplate-id}"].PatchAsync(requestBody);
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
mgc device-management notification-message-templates patch --notification-message-template-id {notificationMessageTemplate-id} --body '{\
"@odata.type": "#microsoft.graph.notificationMessageTemplate",\
"displayName": "Display Name value",\
"defaultLocale": "Default Locale value",\
"brandingOptions": "includeCompanyLogo",\
"roleScopeTagIds": [\
"Role Scope Tag Ids value"\
]\
}\
'
有关如何将 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.NewNotificationMessageTemplate()
displayName := "Display Name value"
requestBody.SetDisplayName(&displayName)
defaultLocale := "Default Locale value"
requestBody.SetDefaultLocale(&defaultLocale)
brandingOptions := graphmodels.INCLUDECOMPANYLOGO_NOTIFICATIONTEMPLATEBRANDINGOPTIONS
requestBody.SetBrandingOptions(&brandingOptions)
roleScopeTagIds := []string {
"Role Scope Tag Ids value",
}
requestBody.SetRoleScopeTagIds(roleScopeTagIds)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
notificationMessageTemplates, err := graphClient.DeviceManagement().NotificationMessageTemplates().ByNotificationMessageTemplateId("notificationMessageTemplate-id").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);
NotificationMessageTemplate notificationMessageTemplate = new NotificationMessageTemplate();
notificationMessageTemplate.setOdataType("#microsoft.graph.notificationMessageTemplate");
notificationMessageTemplate.setDisplayName("Display Name value");
notificationMessageTemplate.setDefaultLocale("Default Locale value");
notificationMessageTemplate.setBrandingOptions(EnumSet.of(NotificationTemplateBrandingOptions.IncludeCompanyLogo));
LinkedList<String> roleScopeTagIds = new LinkedList<String>();
roleScopeTagIds.add("Role Scope Tag Ids value");
notificationMessageTemplate.setRoleScopeTagIds(roleScopeTagIds);
NotificationMessageTemplate result = graphClient.deviceManagement().notificationMessageTemplates().byNotificationMessageTemplateId("{notificationMessageTemplate-id}").patch(notificationMessageTemplate);
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
const options = {
authProvider,
};
const client = Client.init(options);
const notificationMessageTemplate = {
'@odata.type': '#microsoft.graph.notificationMessageTemplate',
displayName: 'Display Name value',
defaultLocale: 'Default Locale value',
brandingOptions: 'includeCompanyLogo',
roleScopeTagIds: [
'Role Scope Tag Ids value'
]
};
await client.api('/deviceManagement/notificationMessageTemplates/{notificationMessageTemplateId}')
.update(notificationMessageTemplate);
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\NotificationMessageTemplate;
use Microsoft\Graph\Generated\Models\NotificationTemplateBrandingOptions;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new NotificationMessageTemplate();
$requestBody->setOdataType('#microsoft.graph.notificationMessageTemplate');
$requestBody->setDisplayName('Display Name value');
$requestBody->setDefaultLocale('Default Locale value');
$requestBody->setBrandingOptions(new NotificationTemplateBrandingOptions('includeCompanyLogo'));
$requestBody->setRoleScopeTagIds(['Role Scope Tag Ids value', ]);
$result = $graphServiceClient->deviceManagement()->notificationMessageTemplates()->byNotificationMessageTemplateId('notificationMessageTemplate-id')->patch($requestBody)->wait();
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
Import-Module Microsoft.Graph.DeviceManagement
$params = @{
"@odata.type" = "#microsoft.graph.notificationMessageTemplate"
displayName = "Display Name value"
defaultLocale = "Default Locale value"
brandingOptions = "includeCompanyLogo"
roleScopeTagIds = @(
"Role Scope Tag Ids value"
)
}
Update-MgDeviceManagementNotificationMessageTemplate -NotificationMessageTemplateId $notificationMessageTemplateId -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.notification_message_template import NotificationMessageTemplate
from msgraph.generated.models.notification_template_branding_options import NotificationTemplateBrandingOptions
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = NotificationMessageTemplate(
odata_type = "#microsoft.graph.notificationMessageTemplate",
display_name = "Display Name value",
default_locale = "Default Locale value",
branding_options = NotificationTemplateBrandingOptions.IncludeCompanyLogo,
role_scope_tag_ids = [
"Role Scope Tag Ids value",
],
)
result = await graph_client.device_management.notification_message_templates.by_notification_message_template_id('notificationMessageTemplate-id').patch(request_body)
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
响应
下面是一个响应示例。 注意:为简洁起见,可能会截断此处显示的响应对象。 将从实际调用中返回所有属性。
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 372
{
"@odata.type": "#microsoft.graph.notificationMessageTemplate",
"id": "e1db399b-399b-e1db-9b39-dbe19b39dbe1",
"lastModifiedDateTime": "2017-01-01T00:00:35.1329464-08:00",
"displayName": "Display Name value",
"defaultLocale": "Default Locale value",
"brandingOptions": "includeCompanyLogo",
"roleScopeTagIds": [
"Role Scope Tag Ids value"
]
}