protectionRuleBase を作成する

名前空間: microsoft.graph

保護ポリシーに関連付けられている新しい保護 規則 を作成 します。 このメソッドを使用して、 メールボックス、 driveProtectionRule、または siteIProtectionRule を作成できます。

包含規則は、保護ポリシーに、指定された規則の条件に一致する保護ユニットを含める必要があることを示します。 作成時の保護規則の初期状態は active。 ルールが適用されると、状態は completed または completedWithErrorsのいずれかになります。

アクセス許可

この API の最小特権としてマークされているアクセス許可またはアクセス許可を選択します。 アプリで必要な場合にのみ、より高い特権のアクセス許可またはアクセス許可を使用します。 委任されたアクセス許可とアプリケーションのアクセス許可の詳細については、「アクセス許可の種類」を参照してください。 これらのアクセス許可の詳細については、「アクセス許可のリファレンス」を参照してください。

アクセス許可の種類 最小特権アクセス許可 より高い特権のアクセス許可
委任 (職場または学校のアカウント) BackupRestore-Configuration.ReadWrite.All 注意事項なし。
委任 (個人用 Microsoft アカウント) サポートされていません。 サポートされていません。
アプリケーション BackupRestore-Configuration.ReadWrite.All 注意事項なし。

HTTP 要求

POST /solutions/backupRestore/sharePointProtectionPolicies/{sharePointProtectionPolicyId}/siteInclusionRules
POST /solutions/backupRestore/oneDriveForBusinessProtectionPolicies/{oneDriveForBusinessProtectionPolicyId}/driveInclusionRules
POST /solutions/backupRestore/exchangeProtectionPolicies/{exchangeProtectionPolicyId}/mailboxInclusionRules

要求ヘッダー

名前 説明
Authorization ベアラー {token}。 必須です。 認証と認可についての詳細をご覧ください。

要求本文

要求本文で、 protectionRuleBase オブジェクトの JSON 表現を指定します。

新しい siteInclusionRule を作成するためのプロパティ

siteInclusionRule を作成するときに、次のプロパティを指定できます。

プロパティ 型 説明
siteExpression String サイト式が含まれます。 必須。

新しい driveInclusionRule を作成するためのプロパティ

driveInclusionRule を作成するときに、次のプロパティを指定できます。

プロパティ 型 説明
driveExpression String ドライブ式を格納します。 必須。

新しいメールボックスを作成するためのプロパティInclusionRule

mailboxInclusionRule を作成するときに、次のプロパティを指定できます。

プロパティ 型 説明
mailboxExpression String メールボックス式が含まれます。 プロパティの memberOf と group.id をサポートします。 必須

応答

成功した場合、このメソッドは応答コード 201 Created と、応答本文に protectionRuleBase オブジェクトを返します。

考えられるエラー応答の一覧については、「 Backup Storage API エラー応答」を参照してください。

例

例 1: SharePoint 保護ポリシーに関連付けられた新しい siteInclusionRule を作成する

次の例では、sharePointProtectionPolicy に関連付けられた新しい siteInclusionRule を作成する方法を示します。

要求

次の例は要求を示しています。

POST https://graph.microsoft.com/v1.0/solutions/backupRestore/sharePointProtectionPolicies/71633878-8321-4950-bfaf-ed285bdd1461/siteInclusionRules 
Content-Type: application/json

{
    "siteExpression": "((displayName -contains 'Finance')  -or  (displayName -contains 'Legal'))"
}

応答

次の例は応答を示しています。

HTTP/1.1 201 Created
Content-Location: https://graph.microsoft.com/v1.0/solutions/backupRestore/sharePointProtectionPolicies/71633878-8321-4950-bfaf-ed285bdd1461/siteInclusionRules('61633878-8321-4950-bfaf-ed285bdd1461')

{
   "@odata.type": "#microsoft.graph.siteProtectionRule",
   "id":"61633878-8321-4950-bfaf-ed285bdd1461",
   "status" : "active",
   "createdBy":{
      "application":{
         "id":"1fec8e78-bce4-4aaf-ab1b-5451cc387264"
      },
      "user":{
         "id":"845457dc-4bb2-4815-bef3-8628ebd1952e"
      }
   },
   "createdDateTime":"2015-06-19T12:01:03.45Z",
   "lastModifiedBy":{
      "application":{
         "id":"1fec8e78-bce4-4aaf-ab1b-5451cc387264"
      },
      "user":{
         "id":"845457dc-4bb2-4815-bef3-8628ebd1952e"
      }
   },
   "lastModifiedDateTime":"2015-06-19T12:01:03.45Z",
   "isAutoApplyEnabled": false,
   "siteExpression": "((displayName -contains 'Finance')  -or  (displayName -contains 'Legal'))"
}

例 2: OneDriveForBusiness 保護ポリシーに関連付けられている新しい driveInclusionRule を作成する

次の例では、oneDriveForBusinessProtectionPolicy に関連付けられた新しい driveInclusionRule を作成する方法を示します。

要求

次の例は要求を示しています。

POST https://graph.microsoft.com/v1.0/solutions/backupRestore/oneDriveForBusinessProtectionPolicies/71633878-8321-4950-bfaf-ed285bdd1461/driveInclusionRules 
Content-Type: application/json

{
    "driveExpression": "(memberOf -any (group.id -in ['c318eb4a-ea72-42bd-8f0b-d0bbf794bec7']))"
}

応答

次の例は応答を示しています。

HTTP/1.1 201 Created
Content-Location: https://graph.microsoft.com/v1.0/solutions/backupRestore/oneDriveForBusinessProtectionPolicies/71633878-8321-4950-bfaf-ed285bdd1461/driveInclusionRules('61633878-8321-4950-bfaf-ed285bdd1461')

{
   "@odata.type": "#microsoft.graph.driveProtectionRule",
   "id":"61633878-8321-4950-bfaf-ed285bdd1461",
   "status" : "active",
   "createdBy":{
      "application":{
         "id":"1fec8e78-bce4-4aaf-ab1b-5451cc387264"
      },
      "user":{
         "id":"845457dc-4bb2-4815-bef3-8628ebd1952e"
      }
   },
   "createdDateTime":"2015-06-19T12:01:03.45Z",
   "lastModifiedBy":{
      "application":{
         "id":"1fec8e78-bce4-4aaf-ab1b-5451cc387264"
      },
      "user":{
         "id":"845457dc-4bb2-4815-bef3-8628ebd1952e"
      }
   },
   "lastModifiedDateTime":"2015-06-19T12:01:03.45Z",
   "isAutoApplyEnabled": false,
   "driveExpression": "(memberOf -any (group.id -in ['c318eb4a-ea72-42bd-8f0b-d0bbf794bec7']))"
}

例 3: Exchange 保護ポリシーに関連付けられた新しいメールボックスInclusionRule を作成する

次の例では、exchangeProtectionPolicy に関連付けられた新しいメールボックスInclusionRule を作成する方法を示します。

要求

次の例は要求を示しています。

POST https://graph.microsoft.com/v1.0/solutions/backupRestore/exchangeProtectionPolicies/71633878-8321-4950-bfaf-ed285bdd1461/mailboxInclusionRules

{
   "mailboxExpression": "(memberOf -any (group.id -in ['f218eb4a-ea72-42bd-8f0b-d0bbf794bec7']))"
}

応答

次の例は応答を示しています。

HTTP/1.1 200 OK
Content-Location: https://graph.microsoft.com/v1.0/solutions/backupRestore/exchangeProtectionPolicies/71633878-8321-4950-bfaf-ed285bdd1461/mailboxInclusionRules('61633878-8321-4950-bfaf-ed285bdd1461')

{
   "@odata.type": "#microsoft.graph.mailboxProtectionRule",
   "id":"61633878-8321-4950-bfaf-ed285bdd1461",
   "status" : "active",
   "createdBy":{
      "application":{
         "id":"1fec8e78-bce4-4aaf-ab1b-5451cc387264"
      },
      "user":{
         "id":"845457dc-4bb2-4815-bef3-8628ebd1952e"
      }
   },
   "createdDateTime":"2015-06-19T12:01:03.45Z",
   "lastModifiedBy":{
      "application":{
         "id":"1fec8e78-bce4-4aaf-ab1b-5451cc387264"
      },
      "user":{
         "id":"845457dc-4bb2-4815-bef3-8628ebd1952e"
      }
   },
   "lastModifiedDateTime":"2015-06-19T12:01:03.45Z",
   "isAutoApplyEnabled": false,
   "mailboxExpression": "(memberOf -any (group.id -in ['f218eb4a-ea72-42bd-8f0b-d0bbf794bec7']))"
}