更新 protectionRuleBase
命名空间:microsoft.graph
重要
Microsoft Graph /beta
版本下的 API 可能会发生更改。 不支持在生产应用程序中使用这些 API。 若要确定 API 是否在 v1.0 中可用,请使用 版本 选择器。
更新 protectionRuleBase 对象的属性。 仅 exchangeProtectionPolicy 和 onedriveForBusinessProtectionPolicy 对象的动态规则支持此方法。 应用更新后,将设置 updateRequested
protectionRuleBase 对象的 status 属性的值。
权限
为此 API 选择标记为最低特权的权限。 只有在应用需要它时,才使用更高的特权权限。 有关委派权限和应用程序权限的详细信息,请参阅权限类型。 要了解有关这些权限的详细信息,请参阅 权限参考。
权限类型 | 最低特权权限 | 更高特权权限 |
---|---|---|
委派(工作或学校帐户) | BackupRestore-Configuration.ReadWrite.All | 不可用。 |
委派(个人 Microsoft 帐户) | 不支持。 | 不支持。 |
应用程序 | BackupRestore-Configuration.ReadWrite.All | 不可用。 |
HTTP 请求
PATCH /solutions/backupRestore/oneDriveForBusinessProtectionPolicies/{oneDriveForBusinessProtectionPolicyId}/driveInclusionRules/{driveProtectionRuleId}
PATCH /solutions/backupRestore/exchangeProtectionPolicies/{exchangeProtectionPolicyId}/mailboxInclusionRules/{mailboxProtectionRuleId}
请求标头
名称 | 说明 |
---|---|
Authorization | 持有者 {token}。 必填。 详细了解 身份验证和授权。 |
Content-Type | application/json. 必需。 |
请求正文
在请求正文中, 仅 提供要更新的属性的值。 请求正文中未包含的现有属性会保留其以前的值,或者根据对其他属性值的更改重新计算。
下表指定可更新的属性。
在请求正文中,提供以下属性之一的 JSON 表示形式,以更新 protectionRuleBase 对象。
属性 | 类型 | 说明 |
---|---|---|
driveExpression | String | 包含驱动器表达式。 有关示例,请参阅 driveExpression 示例。 |
mailboxExpression | String | 包含邮箱表达式。 有关示例,请参阅 mailboxExpression 示例。 |
响应
如果成功,此方法在响应正文中返回响应 200 OK
代码和更新的 protectionRuleBase 对象。
示例
示例 1:更新与 onedriveForBusiness 保护策略关联的 driveInclusionRule
以下示例演示如何更新与 onedriveForBusinessProtectionPolicy 关联的 driveInclusionRule。
请求
以下示例显示了一个请求。
PATCH https://graph.microsoft.com/beta/solutions/backupRestore/oneDriveForBusinessProtectionPolicies/e267a763-ca81-4a98-8c1a-f407143cffe1/driveInclusionRules/c31adc5c-b65d-4a85-8eda-976947a24124
Content-Type: application/json
{
"driveExpression": "(memberOf -any (group.id -in ['4e8e9b15-bfc8-40a2-aed0-3f65a22e2bd4']))"
}
响应
以下示例显示了相应的响应。
注意:为了提高可读性,可能缩短了此处显示的响应对象。
HTTP/1.1 200 OK
Content-Type: application/json
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#Collection(microsoft.graph.driveProtectionRule)",
"id": "c31adc5c-b65d-4a85-8eda-976947a24124",
"status": "updateRequested",
"createdDateTime": "2025-01-15T14:42:34.5329239Z",
"lastModifiedDateTime": "2025-01-15T14:58:08.5918017Z",
"isAutoApplyEnabled": true,
"createdBy": {
"application": {
"id": "1fec8e78-bce4-4aaf-ab1b-5451cc387264"
},
"user": {
"id": "845457dc-4bb2-4815-bef3-8628ebd1952e"
}
},
"lastModifiedBy": {
"application": {
"id": "1fec8e78-bce4-4aaf-ab1b-5451cc387264"
},
"user": {
"id": "845457dc-4bb2-4815-bef3-8628ebd1952e"
}
},
"driveExpression": "(memberOf -any (group.id -in ['4e8e9b15-bfc8-40a2-aed0-3f65a22e2bd4']))"
}
示例 2:更新与 Exchange 保护策略关联的 mailboxInclusionRule
以下示例演示如何更新与 exchangeProtectionPolicy 关联的 mailboxInclusionRule。
请求
以下示例显示了一个请求。
PATCH https://graph.microsoft.com/beta/solutions/backupRestore/exchangeProtectionPolicies/e267a763-ca81-4a98-8c1a-f407143cffe1/mailboxInclionRules/c31adc5c-b65d-4a85-8eda-976947a24124
Content-Type: application/json
{
"mailboxExpression": "(memberOf -any (group.id -in ['c318eb4a-ea72-42bd-8f0b-d0bbf794bec7']))"
}
响应
以下示例显示了相应的响应。
注意:为了提高可读性,可能缩短了此处显示的响应对象。
HTTP/1.1 200 OK
Content-Type: application/json
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#Collection(microsoft.graph.mailboxProtectionRule)",
"id": "c31adc5c-b65d-4a85-8eda-976947a24124",
"status": "updateRequested",
"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": true,
"mailboxExpression": "(memberOf -any (group.id -in ['c318eb4a-ea72-42bd-8f0b-d0bbf794bec7']))"
}