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": {
"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;
var requestBody = new EmailNotificationsSetting
{
IsEnabled = true,
AdditionalEvents = NotificationEventsType.RestoreAndPolicyUpdates,
Recipients = new NotificationRecipients
{
Role = NotificationRecipientsType.Custom,
CustomRecipients = new List<EmailIdentity>
{
new EmailIdentity
{
Email = "amala@contoso.com",
},
new EmailIdentity
{
Email = "conrad@contoso.com",
},
new EmailIdentity
{
Email = "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 major version. Current major version is $v0.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-beta-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewEmailNotificationsSetting()
isEnabled := true
requestBody.SetIsEnabled(&isEnabled)
additionalEvents := graphmodels.RESTOREANDPOLICYUPDATES_NOTIFICATIONEVENTSTYPE
requestBody.SetAdditionalEvents(&additionalEvents)
recipients := graphmodels.NewNotificationRecipients()
role := graphmodels.CUSTOM_NOTIFICATIONRECIPIENTSTYPE
recipients.SetRole(&role)
emailIdentity := graphmodels.NewEmailIdentity()
email := "amala@contoso.com"
emailIdentity.SetEmail(&email)
emailIdentity1 := graphmodels.NewEmailIdentity()
email := "conrad@contoso.com"
emailIdentity1.SetEmail(&email)
emailIdentity2 := graphmodels.NewEmailIdentity()
email := "lothar@contoso.com"
emailIdentity2.SetEmail(&email)
customRecipients := []graphmodels.EmailIdentityable {
emailIdentity,
emailIdentity1,
emailIdentity2,
}
recipients.SetCustomRecipients(customRecipients)
requestBody.SetRecipients(recipients)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
emailNotificationsSetting, err := graphClient.Solutions().BackupRestore().EmailNotificationsSetting().Patch(context.Background(), requestBody, nil)
// 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();
recipients.setRole(EnumSet.of(NotificationRecipientsType.Custom));
LinkedList<EmailIdentity> customRecipients = new LinkedList<EmailIdentity>();
EmailIdentity emailIdentity = new EmailIdentity();
emailIdentity.setEmail("amala@contoso.com");
customRecipients.add(emailIdentity);
EmailIdentity emailIdentity1 = new EmailIdentity();
emailIdentity1.setEmail("conrad@contoso.com");
customRecipients.add(emailIdentity1);
EmailIdentity emailIdentity2 = new EmailIdentity();
emailIdentity2.setEmail("lothar@contoso.com");
customRecipients.add(emailIdentity2);
recipients.setCustomRecipients(customRecipients);
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: {
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;
use Microsoft\Graph\Beta\Generated\Models\NotificationRecipientsType;
use Microsoft\Graph\Beta\Generated\Models\EmailIdentity;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new EmailNotificationsSetting();
$requestBody->setIsEnabled(true);
$requestBody->setAdditionalEvents(new NotificationEventsType('restoreAndPolicyUpdates'));
$recipients = new NotificationRecipients();
$recipients->setRole(new NotificationRecipientsType('custom'));
$customRecipientsEmailIdentity1 = new EmailIdentity();
$customRecipientsEmailIdentity1->setEmail('amala@contoso.com');
$customRecipientsArray []= $customRecipientsEmailIdentity1;
$customRecipientsEmailIdentity2 = new EmailIdentity();
$customRecipientsEmailIdentity2->setEmail('conrad@contoso.com');
$customRecipientsArray []= $customRecipientsEmailIdentity2;
$customRecipientsEmailIdentity3 = new EmailIdentity();
$customRecipientsEmailIdentity3->setEmail('lothar@contoso.com');
$customRecipientsArray []= $customRecipientsEmailIdentity3;
$recipients->setCustomRecipients($customRecipientsArray);
$requestBody->setRecipients($recipients);
$result = $graphServiceClient->solutions()->backupRestore()->emailNotificationsSetting()->patch($requestBody)->wait();
Import-Module Microsoft.Graph.Beta.BackupRestore
$params = @{
isEnabled = "true"
additionalEvents = "restoreAndPolicyUpdates"
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
from msgraph_beta.generated.models.notification_recipients_type import NotificationRecipientsType
from msgraph_beta.generated.models.email_identity import EmailIdentity
# 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(
role = NotificationRecipientsType.Custom,
custom_recipients = [
EmailIdentity(
email = "amala@contoso.com",
),
EmailIdentity(
email = "conrad@contoso.com",
),
EmailIdentity(
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": {
"role": "custom",
"customRecipients": [
{
"email": "amala@contoso.com"
},
{
"email": "conrad@contoso.com"
},
{
"email": "lothar@contoso.com"
}
]
}
}