创建 exchangeProtectionPolicy

命名空间:microsoft.graph

为 Microsoft 365 租户中的 Exchange 服务创建保护策略。 策略设置为 inactive 创建时。 用户还可以提供策略下的保护单位列表。

API 可用性

此 API 可用于以下国家级云部署。

全局服务 美国政府 L4 美国政府 L5 (DOD) 由世纪互联运营的中国
✅ ❌ ❌ ❌

权限

为此 API 选择标记为最低特权的权限。 只有在应用需要它时,才使用更高的特权权限。 有关委派权限和应用程序权限的详细信息,请参阅权限类型。 要了解有关这些权限的详细信息,请参阅 权限参考。

权限类型 最低特权权限 更高特权权限
委派(工作或学校帐户) BackupRestore-Configuration.ReadWrite.All 不可用。
委派(个人 Microsoft 帐户) 不支持。 不支持。
应用程序 BackupRestore-Configuration.ReadWrite.All 不可用。

HTTP 请求

POST /solutions/backupRestore/exchangeProtectionPolicies/

请求标头

名称 说明
Authorization 持有者 {token}。 必填。 详细了解 身份验证和授权。
Content-Type application/json. 必需。

请求正文

在请求正文中,包含 exchangeProtectionPolicy 对象的 JSON 表示形式。

创建 exchangeProtectionPolicy 对象时,可以指定以下属性。

属性 类型 说明
displayName String Exchange 保护策略的名称。
mailboxProtectionUnits mailboxProtectionUnit 集合 要添加到 exchangeProtectionPolicy 的 mailboxProtectionUnits 的集合。
retentionSettings retentionSetting 集合 策略的保留设置。 可选。 如果省略,则默认保留期为 365 天。

响应

如果成功,此方法将在响应正文中返回 201 Created 响应代码和 exchangeProtectionPolicy 对象。

该服务返回完整的 retentionSettings 集合,而不是回显请求集合。 响应包括该间隔的R/PT10M固定 14 天 (P14D) 和该R/P1W间隔配置的策略保留期。 14 天是服务定义的备份层,不是创建或更新请求支持的策略保留期。

有关可能的错误响应列表,请参阅 备份存储 API 错误响应。

示例

请求

以下示例显示了如何创建保留期为 180 天的策略。

POST https://graph.microsoft.com/v1.0/solutions/backupRestore/exchangeProtectionPolicies
Content-Type: application/json

{
  "displayName": "Exchange Protection Policy",
  "mailboxProtectionUnits": [
    {
      "directoryObjectId": "cdd3a849-dcaf-4a85-af82-7e39fc14019a"
    },
    {
      "directoryObjectId": "9bc069da-b746-41a4-89ab-26125c6373c7"
    },
    {
      "directoryObjectId": "b218eb4a-ea72-42bd-8f0b-d0bbf794bec7"
    }
  ],
  "retentionSettings": [
    {
      "interval": "R/P1W",
      "period": "P180D"
    }
  ]
}

响应

下面的示例显示了两个备份间隔的保留设置的响应,包括请求的 180 天保留期。

注意:为了提高可读性,可能缩短了此处显示的响应对象。

HTTP/1.1 201 Created
Content-Location: https://graph.microsoft.com/v1.0/solutions/backupRestore/ProtectionPolicies/b218eb4a-ea72-42bd-8f0b-d0bbf794bec7

{
  "@odata.context": "/solutions/backupRestore/$metadata#exchangeProtectionPolicies/$entity",
  "id": "b218eb4a-ea72-42bd-8f0b-d0bbf794bec7",
  "displayName": "Exchange Protection Policy",
  "status": "inactive",
  "createdBy": {
    "application": {
      "id": "1fec8e78-bce4-4aaf-ab1b-5451cc387264",
      "displayName": "Microsoft Enhanced Restore"
    },
    "user": {
      "email": "User1@contoso.com",
      "id": "845457dc-4bb2-4815-bef3-8628ebd1952e",
      "displayName": "User1"
    }
  },
  "createdDateTime": "2015-06-19T12:01:03.45Z",
  "lastModifiedBy": {
    "application": {
      "id": "1fec8e78-bce4-4aaf-ab1b-5451cc387264",
      "displayName": "Microsoft Enhanced Restore"
    },
    "user": {
      "email": "User2@constoso.com",
      "id": "845457dc-4bb2-4815-bef3-8628ebd1952e",
      "displayName": "User2"
    }
  },
  "lastModifiedDateTime": "2015-06-19T12:01:03.45Z",
  "retentionSettings": [
    {
      "interval": "R/PT10M",
      "period": "P14D"
    },
    {
      "interval": "R/P1W",
      "period": "P180D"
    }
  ]
}