Namespace: microsoft.graph
Note: The Microsoft Graph API for Intune requires an active Intune license for the tenant.
Create a new notificationMessageTemplate object.
This API is available in the following national cloud deployments.
Global service |
US Government L4 |
US Government L5 (DOD) |
China operated by 21Vianet |
✅ |
✅ |
✅ |
✅ |
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) |
DeviceManagementServiceConfig.ReadWrite.All |
Delegated (personal Microsoft account) |
Not supported. |
Application |
DeviceManagementServiceConfig.ReadWrite.All |
HTTP Request
POST /deviceManagement/notificationMessageTemplates
Request body
In the request body, supply a JSON representation for the notificationMessageTemplate object.
The following table shows the properties that are required when you create the notificationMessageTemplate.
Property |
Type |
Description |
id |
String |
Key of the entity. |
lastModifiedDateTime |
DateTimeOffset |
DateTime the object was last modified. |
displayName |
String |
Display name for the Notification Message Template. |
defaultLocale |
String |
The default locale to fallback onto when the requested locale is not available. |
brandingOptions |
notificationTemplateBrandingOptions |
The Message Template Branding Options. Branding is defined in the Intune Admin Console. Possible values are: none , includeCompanyLogo , includeCompanyName , includeContactInformation , includeCompanyPortalLink , includeDeviceDetails , unknownFutureValue . |
roleScopeTagIds |
String collection |
List of Scope Tags for this Entity instance. |
Response
If successful, this method returns a 201 Created
response code and a notificationMessageTemplate object in the response body.
Example
Request
Here is an example of the request.
POST https://graph.microsoft.com/v1.0/deviceManagement/notificationMessageTemplates
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.PostAsync(requestBody);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
mgc device-management notification-message-templates create --body '{\
"@odata.type": "#microsoft.graph.notificationMessageTemplate",\
"displayName": "Display Name value",\
"defaultLocale": "Default Locale value",\
"brandingOptions": "includeCompanyLogo",\
"roleScopeTagIds": [\
"Role Scope Tag Ids value"\
]\
}\
'
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
// 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().Post(context.Background(), requestBody, nil)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
// 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().post(notificationMessageTemplate);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
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')
.post(notificationMessageTemplate);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
<?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()->post($requestBody)->wait();
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
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"
)
}
New-MgDeviceManagementNotificationMessageTemplate -BodyParameter $params
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
# 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.post(request_body)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
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 201 Created
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"
]
}