Namespace: microsoft.graph
Aktualisieren sie die Eigenschaften eines emailNotificationsSetting-Objekts .
Diese API ist in den folgenden nationalen Cloudbereitstellungen verfügbar.
| Weltweiter Service |
US Government L4 |
US Government L5 (DOD) |
China, betrieben von 21Vianet |
| ✅ |
❌ |
❌ |
❌ |
Berechtigungen
Wählen Sie die Berechtigungen aus, die für diese API als am wenigsten privilegiert markiert sind. Verwenden Sie eine höhere Berechtigung oder Berechtigungen nur, wenn Ihre App dies erfordert. Ausführliche Informationen zu delegierten Berechtigungen und Anwendungsberechtigungen finden Sie unter Berechtigungstypen. Weitere Informationen zu diesen Berechtigungen finden Sie in der Berechtigungsreferenz.
| Berechtigungstyp |
Berechtigungen mit den geringsten Berechtigungen |
Berechtigungen mit höheren Berechtigungen |
| Delegiert (Geschäfts-, Schul- oder Unikonto) |
BackupRestore-Control.ReadWrite.All |
Nicht verfügbar. |
| Delegiert (persönliches Microsoft-Konto) |
Nicht unterstützt |
Nicht unterstützt |
| Application |
Nicht unterstützt |
Nicht unterstützt |
HTTP-Anforderung
PATCH /solutions/backupRestore/emailNotificationsSetting
Anforderungstext
Geben Sie im Anforderungstext nur die Werte für zu aktualisierende Eigenschaften an. Vorhandene Eigenschaften, die nicht im Anforderungstext enthalten sind, behalten ihre vorherigen Werte bei oder werden basierend auf Änderungen an anderen Eigenschaftswerten neu berechnet.
In der folgenden Tabelle sind die Eigenschaften angegeben, die aktualisiert werden können.
| Eigenschaft |
Typ |
Beschreibung |
| additionalEvents |
notificationEventsType |
Gibt an, ob zusätzliche Richtlinien- und Wiederherstellungsupdates aktiviert werden sollen. Mögliche Werte: none, restoreAndPolicyUpdates, unknownFutureValue. |
| isEnabled |
Boolescher Wert |
Gibt an, ob Benachrichtigungen aktiviert sind. |
| recipients |
notificationRecipients |
Gibt die Empfänger an, die die Benachrichtigungen erhalten. |
Antwort
Bei erfolgreicher Ausführung gibt die Methode einen 200 OK Antwortcode und ein aktualisiertes emailNotificationsSetting-Objekt im Antworttext zurück.
Beispiele
Anforderung
Das folgende Beispiel zeigt eine Anfrage.
PATCH https://graph.microsoft.com/v1.0/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.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);
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen, finden Sie in der SDK-Dokumentation.
// 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.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)
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen, finden Sie in der SDK-Dokumentation.
// 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);
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen, finden Sie in der SDK-Dokumentation.
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')
.update(emailNotificationsSetting);
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen, finden Sie in der SDK-Dokumentation.
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\EmailNotificationsSetting;
use Microsoft\Graph\Generated\Models\NotificationEventsType;
use Microsoft\Graph\Generated\Models\NotificationRecipients;
use Microsoft\Graph\Generated\Models\NotificationRecipientsType;
use Microsoft\Graph\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();
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen, finden Sie in der SDK-Dokumentation.
Import-Module Microsoft.Graph.BackupRestore
$params = @{
isEnabled = $true
additionalEvents = "restoreAndPolicyUpdates"
recipients = @{
role = "custom"
customRecipients = @(
@{
email = "amala@contoso.com"
}
@{
email = "conrad@contoso.com"
}
@{
email = "lothar@contoso.com"
}
)
}
}
Update-MgSolutionBackupRestoreEmailNotificationSetting -BodyParameter $params
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen, finden Sie in der SDK-Dokumentation.
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.models.email_notifications_setting import EmailNotificationsSetting
from msgraph.generated.models.notification_events_type import NotificationEventsType
from msgraph.generated.models.notification_recipients import NotificationRecipients
from msgraph.generated.models.notification_recipients_type import NotificationRecipientsType
from msgraph.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)
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen, finden Sie in der SDK-Dokumentation.
Antwort
Das folgende Beispiel zeigt die Antwort.
Hinweis: Das hier gezeigte Antwortobjekt kann zur besseren Lesbarkeit gekürzt werden.
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"
}
]
}
}