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.
Update the properties of an emailNotificationsSetting 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
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) |
BackupRestore-Control.ReadWrite.All |
Not available. |
Delegated (personal Microsoft account) |
Not supported. |
Not supported. |
Application |
Not supported. |
Not supported. |
HTTP request
PATCH /solutions/backupRestore/emailNotificationsSetting
Request body
In the request body, supply only the values for properties to update. Existing properties that aren't included in the request body maintain their previous values or are recalculated based on changes to other property values.
The following table specifies the properties that can be updated.
Property |
Type |
Description |
additionalEvents |
notificationEventsType |
Indicates whether to opt in to additional policy and restore updates. Possible values: none , restoreAndPolicyUpdates , unknownFutureValue . |
isEnabled |
Boolean |
Indicates whether notifications are enabled. |
recipients |
notificationRecipients |
A list of recipients who receive the notifications. |
Response
If successful, this method returns a 200 OK
response code and an updated emailNotificationsSetting object in the response body.
Examples
Request
The following example shows a request.
PATCH https://graph.microsoft.com/beta/solutions/backupRestore/emailNotificationsSetting
Content-Type: application/json
{
"isEnabled": "true",
"additionalEvents": "restoreAndPolicyUpdates",
"recipients": {
"recipients": {
"role": "custom",
"customRecipients": [
{
"email": "amala@contoso.com"
},
{
"email": "conrad@contoso.com"
},
{
"email": "lothar@contoso.com"
}
]
}
}
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
using Microsoft.Kiota.Abstractions.Serialization;
var requestBody = new EmailNotificationsSetting
{
IsEnabled = true,
AdditionalEvents = NotificationEventsType.RestoreAndPolicyUpdates,
Recipients = new NotificationRecipients
{
AdditionalData = new Dictionary<string, object>
{
{
"recipients" , new UntypedObject(new Dictionary<string, UntypedNode>
{
{
"role", new UntypedString("custom")
},
{
"customRecipients", new UntypedArray(new List<UntypedNode>
{
new UntypedObject(new Dictionary<string, UntypedNode>
{
{
"email", new UntypedString("amala@contoso.com")
},
}),
new UntypedObject(new Dictionary<string, UntypedNode>
{
{
"email", new UntypedString("conrad@contoso.com")
},
}),
new UntypedObject(new Dictionary<string, UntypedNode>
{
{
"email", new UntypedString("lothar@contoso.com")
},
}),
})
},
})
},
},
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Solutions.BackupRestore.EmailNotificationsSetting.PatchAsync(requestBody);
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
EmailNotificationsSetting emailNotificationsSetting = new EmailNotificationsSetting();
emailNotificationsSetting.setIsEnabled(true);
emailNotificationsSetting.setAdditionalEvents(EnumSet.of(NotificationEventsType.RestoreAndPolicyUpdates));
NotificationRecipients recipients = new NotificationRecipients();
HashMap<String, Object> additionalData = new HashMap<String, Object>();
recipients1 = new ();
recipients1.setRole("custom");
LinkedList<Object> customRecipients = new LinkedList<Object>();
property = new ();
property.setEmail("amala@contoso.com");
customRecipients.add(property);
property1 = new ();
property1.setEmail("conrad@contoso.com");
customRecipients.add(property1);
property2 = new ();
property2.setEmail("lothar@contoso.com");
customRecipients.add(property2);
recipients1.setCustomRecipients(customRecipients);
additionalData.put("recipients", recipients1);
recipients.setAdditionalData(additionalData);
emailNotificationsSetting.setRecipients(recipients);
EmailNotificationsSetting result = graphClient.solutions().backupRestore().emailNotificationsSetting().patch(emailNotificationsSetting);
const options = {
authProvider,
};
const client = Client.init(options);
const emailNotificationsSetting = {
isEnabled: 'true',
additionalEvents: 'restoreAndPolicyUpdates',
recipients: {
recipients: {
role: 'custom',
customRecipients: [
{
email: 'amala@contoso.com'
},
{
email: 'conrad@contoso.com'
},
{
email: 'lothar@contoso.com'
}
]
}
}
};
await client.api('/solutions/backupRestore/emailNotificationsSetting')
.version('beta')
.update(emailNotificationsSetting);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\EmailNotificationsSetting;
use Microsoft\Graph\Beta\Generated\Models\NotificationEventsType;
use Microsoft\Graph\Beta\Generated\Models\NotificationRecipients;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new EmailNotificationsSetting();
$requestBody->setIsEnabled(true);
$requestBody->setAdditionalEvents(new NotificationEventsType('restoreAndPolicyUpdates'));
$recipients = new NotificationRecipients();
$additionalData = [
'recipients' => [
'role' => 'custom',
'customRecipients' => [
[
'email' => 'amala@contoso.com',
],
[
'email' => 'conrad@contoso.com',
],
[
'email' => 'lothar@contoso.com',
],
],
],
];
$recipients->setAdditionalData($additionalData);
$requestBody->setRecipients($recipients);
$result = $graphServiceClient->solutions()->backupRestore()->emailNotificationsSetting()->patch($requestBody)->wait();
Import-Module Microsoft.Graph.Beta.BackupRestore
$params = @{
isEnabled = "true"
additionalEvents = "restoreAndPolicyUpdates"
recipients = @{
recipients = @{
role = "custom"
customRecipients = @(
@{
email = "amala@contoso.com"
}
@{
email = "conrad@contoso.com"
}
@{
email = "lothar@contoso.com"
}
)
}
}
}
Update-MgBetaSolutionBackupRestoreEmailNotificationSetting -BodyParameter $params
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.models.email_notifications_setting import EmailNotificationsSetting
from msgraph_beta.generated.models.notification_events_type import NotificationEventsType
from msgraph_beta.generated.models.notification_recipients import NotificationRecipients
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = EmailNotificationsSetting(
is_enabled = True,
additional_events = NotificationEventsType.RestoreAndPolicyUpdates,
recipients = NotificationRecipients(
additional_data = {
"recipients" : {
"role" : "custom",
"custom_recipients" : [
{
"email" : "amala@contoso.com",
},
{
"email" : "conrad@contoso.com",
},
{
"email" : "lothar@contoso.com",
},
],
},
}
),
)
result = await graph_client.solutions.backup_restore.email_notifications_setting.patch(request_body)
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
{
"isEnabled": true,
"additionalEvents": "restoreAndPolicyUpdates",
"recipients": {
"recipients": {
"role": "custom",
"customRecipients": [
{
"email": "amala@contoso.com"
},
{
"email": "conrad@contoso.com"
},
{
"email": "lothar@contoso.com"
}
]
}
}
}