名前空間: microsoft.graph
emailNotificationsSetting オブジェクトのプロパティを更新します。
この API は、次の国内クラウド展開で使用できます。
| グローバル サービス |
米国政府機関 L4 |
米国政府機関 L5 (DOD) |
21Vianet が運営する中国 |
| ✅ |
❌ |
❌ |
❌ |
アクセス許可
この API の最小特権としてマークされているアクセス許可またはアクセス許可を選択します。
アプリで必要な場合にのみ、より高い特権のアクセス許可またはアクセス許可を使用します。 委任されたアクセス許可とアプリケーションのアクセス許可の詳細については、「アクセス許可の種類」を参照してください。 これらのアクセス許可の詳細については、「アクセス許可のリファレンス」を参照してください。
| アクセス許可の種類 |
最小特権アクセス許可 |
より高い特権のアクセス許可 |
| 委任 (職場または学校のアカウント) |
BackupRestore-Control.ReadWrite.All |
注意事項なし。 |
| 委任 (個人用 Microsoft アカウント) |
サポートされていません。 |
サポートされていません。 |
| アプリケーション |
サポートされていません。 |
サポートされていません。 |
HTTP 要求
PATCH /solutions/backupRestore/emailNotificationsSetting
| 名前 |
説明 |
| Authorization |
ベアラー {token}。 必須です。
認証と認可についての詳細をご覧ください。 |
| Content-Type |
application/json. 必須です。 |
要求本文
要求本文で、更新するプロパティの値 のみを 指定します。 要求本文に含まれていない既存のプロパティは、以前の値を維持するか、他のプロパティ値の変更に基づいて再計算されます。
次の表に、更新できるプロパティを示します。
| プロパティ |
型 |
説明 |
| additionalEvents |
notificationEventsType |
追加のポリシーをオプトインして更新プログラムを復元するかどうかを示します。 使用可能な値: none、 restoreAndPolicyUpdates、 unknownFutureValue。 |
| isEnabled |
ブール値 |
通知が有効かどうかを示します。 |
| Recipients |
notificationRecipients |
通知を受信する受信者を指定します。 |
応答
成功した場合、このメソッドは応答コード 200 OK と、応答本文で更新された emailNotificationsSetting オブジェクトを返します。
例
要求
次の例は要求を示しています。
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);
プロジェクトに 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.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)
プロジェクトに SDK を追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
// 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);
プロジェクトに SDK を追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
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);
プロジェクトに SDK を追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
<?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();
プロジェクトに SDK を追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
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
プロジェクトに 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.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)
プロジェクトに SDK を追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
応答
次の例は応答を示しています。
注: ここに示す応答オブジェクトは、読みやすさのために短縮されている場合があります。
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"
}
]
}
}