名前空間: microsoft.graph
重要
Microsoft Graph の /beta
バージョンの API は変更される可能性があります。 実稼働アプリケーションでこれらの API を使用することは、サポートされていません。 v1.0 で API を使用できるかどうかを確認するには、Version セレクターを使用します。
protectionPolicyBase をアクティブ化します。
現在、サポートされているアクティブなバックアップ ポリシーは、基になるサービスごとに 1 つだけです (つまり、OneDrive アカウント用、SharePoint サイト用、Exchange Online ユーザー用)。 アクティブな各ポリシーに対して成果物 (サイトまたはユーザー アカウント) を追加または削除できます。
この API は、次の国内クラウド展開で使用できます。
グローバル サービス |
米国政府機関 L4 |
米国政府機関 L5 (DOD) |
21Vianet が運営する中国 |
✅ |
❌ |
❌ |
❌ |
アクセス許可
この API の最小特権としてマークされているアクセス許可またはアクセス許可を選択します。
アプリで必要な場合にのみ、より高い特権のアクセス許可またはアクセス許可を使用します。 委任されたアクセス許可とアプリケーションのアクセス許可の詳細については、「アクセス許可の種類」を参照してください。 これらのアクセス許可の詳細については、「アクセス許可のリファレンス」を参照してください。
アクセス許可の種類 |
最小特権アクセス許可 |
より高い特権のアクセス許可 |
委任 (職場または学校のアカウント) |
BackupRestore-Configuration.ReadWrite.All |
注意事項なし。 |
委任 (個人用 Microsoft アカウント) |
サポートされていません。 |
サポートされていません。 |
アプリケーション |
BackupRestore-Configuration.ReadWrite.All |
注意事項なし。 |
HTTP 要求
POST /solutions/backupRestore/protectionPolicies/{protectionPolicyBaseId}/activate
名前 |
説明 |
Authorization |
ベアラー {token}。 必須です。
認証と認可についての詳細をご覧ください。 |
要求本文
このメソッドには、要求本文を指定しません。
応答
成功した場合、このアクションは応答コード 202 Accepted
と、応答本文に protectionPolicyBase オブジェクトを返します。
考えられるエラー応答の一覧については、「 Backup Storage API エラー応答」を参照してください。
例
例 1: 非アクティブな保護ポリシーをアクティブにする
次の例は、非アクティブな保護ポリシーをアクティブ化する要求を示しています。
要求
次の例は要求を示しています。
POST https://graph.microsoft.com/beta/solutions/backupRestore/ProtectionPolicies/61633878-8321-4950-bfaf-ed285bdd1461/activate
// Code snippets are only available for the latest version. Current version is 5.x
// 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.ProtectionPolicies["{protectionPolicyBase-id}"].Activate.PostAsync();
mgc-beta solutions backup-restore protection-policies activate post --protection-policy-base-id {protectionPolicyBase-id}
// 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"
//other-imports
)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
activate, err := graphClient.Solutions().BackupRestore().ProtectionPolicies().ByProtectionPolicyBaseId("protectionPolicyBase-id").Activate().Post(context.Background(), nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
var result = graphClient.solutions().backupRestore().protectionPolicies().byProtectionPolicyBaseId("{protectionPolicyBase-id}").activate().post();
const options = {
authProvider,
};
const client = Client.init(options);
await client.api('/solutions/backupRestore/ProtectionPolicies/61633878-8321-4950-bfaf-ed285bdd1461/activate')
.version('beta')
.post();
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$result = $graphServiceClient->solutions()->backupRestore()->protectionPolicies()->byProtectionPolicyBaseId('protectionPolicyBase-id')->activate()->post()->wait();
Import-Module Microsoft.Graph.Beta.BackupRestore
Initialize-MgBetaSolutionBackupRestoreProtectionPolicy -ProtectionPolicyBaseId $protectionPolicyBaseId
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
result = await graph_client.solutions.backup_restore.protection_policies.by_protection_policy_base_id('protectionPolicyBase-id').activate.post()
応答
次の例は応答を示しています。
HTTP/1.1 202 Accepted
Content-Location: https://graph.microsoft.com/beta/solutions/backupRestore/protectionPolicies('61633878-8321-4950-bfaf-ed285bdd1461')
{
"@odata.context": "/solutions/backupRestore/$metadata#ProtectionPolicies/$entity",
"@odata.id": "/solutions/backupRestore/ProtectionPolicies(61633878-8321-4950-bfaf-ed285bdd1461)",
"@odata.type": "#microsoft.graph.sharePointProtectionPolicy",
"id": "61633878-8321-4950-bfaf-ed285bdd1461",
"displayName": "SharePoint Protection Policy",
"status": "updating",
"createdBy": {
"application": {
"id": "1fec8e78-bce4-4aaf-ab1b-5451cc387264",
"displayName": "Microsoft Enhanced Restore"
},
"user": {
"email": "ryan@contoso.com",
"id": "845457dc-4bb2-4815-bef3-8628ebd1952e",
"displayName": "Ryan"
}
},
"createdDateTime": "2015-06-19T12:01:03.45Z",
"lastModifiedBy": {
"application": {
"id": "1fec8e78-bce4-4aaf-ab1b-5451cc387264",
"displayName": "Microsoft Enhanced Restore"
},
"user": {
"email": "rian@contoso.com",
"id": "845457dc-4bb2-4815-bef3-8628ebd1952e",
"displayName": "rian"
}
},
"lastModifiedDateTime": "2015-06-19T12:01:03.45Z",
"retentionSettings": [
{
"interval": "R/PT10M",
"period": "P2W"
},
{
"interval": "R/P1W",
"period": "P1Y"
}
]
}
例 2: アクティブな保護ポリシーをアクティブにする
次の例は、既にアクティブになっている保護ポリシーをアクティブ化する要求を示しています。 この要求の結果、エラーが発生します。
要求
次の例は要求を示しています。
POST https://graph.microsoft.com/beta/solutions/backupRestore/protectionPolicies/61633878-8321-4950-bfaf-ed285bdd1461/activate
// Code snippets are only available for the latest version. Current version is 5.x
// 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.ProtectionPolicies["{protectionPolicyBase-id}"].Activate.PostAsync();
mgc-beta solutions backup-restore protection-policies activate post --protection-policy-base-id {protectionPolicyBase-id}
// 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"
//other-imports
)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
activate, err := graphClient.Solutions().BackupRestore().ProtectionPolicies().ByProtectionPolicyBaseId("protectionPolicyBase-id").Activate().Post(context.Background(), nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
var result = graphClient.solutions().backupRestore().protectionPolicies().byProtectionPolicyBaseId("{protectionPolicyBase-id}").activate().post();
const options = {
authProvider,
};
const client = Client.init(options);
await client.api('/solutions/backupRestore/protectionPolicies/61633878-8321-4950-bfaf-ed285bdd1461/activate')
.version('beta')
.post();
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$result = $graphServiceClient->solutions()->backupRestore()->protectionPolicies()->byProtectionPolicyBaseId('protectionPolicyBase-id')->activate()->post()->wait();
Import-Module Microsoft.Graph.Beta.BackupRestore
Initialize-MgBetaSolutionBackupRestoreProtectionPolicy -ProtectionPolicyBaseId $protectionPolicyBaseId
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
result = await graph_client.solutions.backup_restore.protection_policies.by_protection_policy_base_id('protectionPolicyBase-id').activate.post()
応答
次の例は応答を示しています。
HTTP/1.1 400 Bad Request
Content-Location: https://graph.microsoft.com/beta/solutions/backupRestore/protectionPolicies/61633878-8321-4950-bfaf-ed285bdd1461
{
"error": {
"code": "invalidStateForActivation",
"message": "Policy in already active state, which is invalid for activation. Policy must be Inactive or ActiveWithErrors state.",
"innerError": {
"date": "2023-03-03T07:15:31",
"request-id": "7e921b55-8af4-41f5-881d-d425af822be0",
"client-request-id": "77d27e8a-f18e-ce3a-42c9-f8a87fc00126"
}
}
}