更新 sharePointProtectionPolicy
命名空间:microsoft.graph
更新 SharePoint 保护策略。 此方法向保护策略添加 siteprotectionunit 或将其从中删除。
此 API 可用于以下国家级云部署。
全局服务 | 美国政府 L4 | 美国政府 L5 (DOD) | 由世纪互联运营的中国 |
---|---|---|---|
✅ | ❌ | ❌ | ❌ |
权限
为此 API 选择标记为最低特权的权限。 只有在应用需要它时,才使用更高的特权权限。 有关委派权限和应用程序权限的详细信息,请参阅权限类型。 要了解有关这些权限的详细信息,请参阅 权限参考。
权限类型 | 最低特权权限 | 更高特权权限 |
---|---|---|
委派(工作或学校帐户) | BackupRestore-Configuration.ReadWrite.All | 不可用。 |
委派(个人 Microsoft 帐户) | 不支持。 | 不支持。 |
应用程序 | BackupRestore-Configuration.ReadWrite.All | 不可用。 |
HTTP 请求
PATCH /solutions/backupRestore/sharePointProtectionPolicies/{sharePointProtectionPolicyId}
请求标头
名称 | 说明 |
---|---|
Authorization | 持有者 {token}。 必填。 详细了解 身份验证和授权。 |
Content-Type | application/json. 必需。 |
请求正文
在请求正文中,提供以下属性的 JSON 表示形式,以更新 sharePointProtectionPolicy 对象。
属性 | 类型 | 说明 |
---|---|---|
displayName | String | sharePointProtectionPolicy 的显示名称。 可选 |
siteProtectionUnits@delta | 集合 (siteProtectionUnit) | 要添加到 sharePointProtectionPolicy 或从中删除的 siteProtectionUnit 对象的集合。 必填。 |
若要从策略中删除 siteProtectionUnit ,请在 @removed
保护单元的请求正文中指定批注以及 siteProtectionUnit 的 ID。
响应
如果成功,此方法在响应正文中返回响应 200 OK
代码和更新的 sharePointProtectionPolicy 。
有关可能的错误响应的列表,请参阅 备份存储 API 错误响应。
示例
请求
以下示例显示了一个请求。
PATCH https://graph.microsoft.com/v1.0/solutions/backupRestore/sharePointProtectionPolicies/845457dc-4bb2-4815-bef3-8628ebd1952e
Content-Type: application/json
{
"displayName": "SharePoint Policy - Inadvertent data loss",
"siteProtectionUnits@delta": [
{
"siteId": "contoso.sharepoint.com,bf6fb551-d508-4946-a439-b2a6154fc1d9,65a04b8b-1f44-442b-a1fc-9e5852fb946c" //Create a new siteProtectionUnit.
},
{
"siteId": "contoso.sharepoint.com,d9ecf079-9b13-4376-ac5d-f242dda55626,746dbcc1-fa2b-4120-b657-2670bae5bb6f"
},
{
"siteId": "contoso.sharepoint.com,fd1a778f-263e-4c43-acdf-d5c2519d80eb,c06016db-dfec-4f79-83a1-09c6dbfd7022"
},
{
"siteId": "contoso.sharepoint.com,bf6fb551-d508-4946-a439-b2a6154fc1d9,65a04b8b-1f44-442b-a1fc-9e5852fb946c"
},
{
"@removed": {
"reason": "changed"
},
"id": "99954f18-c8ec-4b62-85bf-cdf3b70b140e"
},
{
"@removed": {
"reason": "changed"
},
"id": "4267e382-71a9-4c07-bef7-bda97e09c0d2"
},
{
"@removed": {
"reason": "changed"
},
"id": "3667e382-71a9-4c07-bef7-bda97e09c0d2"
}
]
}
响应
以下示例显示了相应的响应。
HTTP/1.1 200 OK
{
"displayName": "SharePoint Policy - Inadvertent data loss",
"siteProtectionUnits@delta": [
{
"id": "89014d8c-71fe-4d00-a01a-31850bc5b32c",
"siteId": "contoso.sharepoint.com,d9ecf079-9b13-4376-ac5d-f242dda55626,746dbcc1-fa2b-4120-b657-2670bae5bb6f",
"policyId": "845457dc-4bb2-4815-bef3-8628ebd1952e",
"status": "protectRequested",
"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": "User1@contoso.com",
"id": "845457dc-4bb2-4815-bef3-8628ebd1952e",
"displayName": "User1"
}
},
"lastModifiedDateTime": "2015-06-19T12:01:03.45Z",
"error": null
},
{
"id": "67014d8c-71fe-4d00-a01a-31850bc5b32c",
"siteId": "contoso.sharepoint.com,fd1a778f-263e-4c43-acdf-d5c2519d80eb,c06016db-dfec-4f79-83a1-09c6dbfd7022",
"policyId": "845457dc-4bb2-4815-bef3-8628ebd1952e",
"status": "protectRequested",
"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": "User1@contoso.com",
"id": "845457dc-4bb2-4815-bef3-8628ebd1952e",
"displayName": "User1"
}
},
"lastModifiedDateTime": "2015-06-19T12:01:03.45Z",
"error": null
},
{
"id": "56014d8c-71fe-4d00-a01a-31850bc5b32c",
"siteId": "contoso.sharepoint.com,bf6fb551-d508-4946-a439-b2a6154fc1d9,65a04b8b-1f44-442b-a1fc-98356ccfas5y",
"policyId": "845457dc-4bb2-4815-bef3-8628ebd1952e",
"status": "protectRequested",
"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": "User1@contoso.com",
"id": "845457dc-4bb2-4815-bef3-8628ebd1952e",
"displayName": "User1"
}
},
"lastModifiedDateTime": "2015-06-19T12:01:03.45Z",
"error": null
},
{
"id": "32014d8c-71fe-4d00-a01a-31850bc5b32c",
"siteId": "contoso.sharepoint.com,bf6fb551-d508-4946-a439-b2a6154fc1d9,65a04b8b-1f44-442b-a1fc-9e5852fb8970",
"policyId": "845457dc-4bb2-4815-bef3-8628ebd1952e",
"status": "protectRequested",
"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": "User1@contoso.com",
"id": "845457dc-4bb2-4815-bef3-8628ebd1952e",
"displayName": "User1"
}
},
"lastModifiedDateTime": "2015-06-19T12:01:03.45Z",
"error": null
},
{
"policyId": "845457dc-4bb2-4815-bef3-8628ebd1952e",
"id": "99954f18-c8ec-4b62-85bf-cdf3b70b140e",
"siteId": "contoso.sharepoint.com,bf6fb551-d508-4946-a439-b2a6154fc1d9,65a04b8b-1f44-442b-a1fc-9e5852fbrtys",
"status": "removeRequested",
"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": "User1@contoso.com",
"id": "845457dc-4bb2-4815-bef3-8628ebd1952e",
"displayName": "User1"
}
},
"lastModifiedDateTime": "2015-06-19T12:01:03.45Z",
"error": null
},
{
//Error scenario
"@contentId": "3467e382-71a9-4c07-bef7-bda97e09c0d2", // To add context and more traceability.
"@Core.DataModificationException": {
"info": {
"code": "Invalid",
"message": "The identifier to be removed from the Protection Policy does not exist"
},
"failedOperation": "remove",
"responseCode": 409
},
"id": "4267e382-71a9-4c07-bef7-bda97e09c0d2"
},
{
"id": "3667e382-71a9-4c07-bef7-bda97e09c0d2",
"policyId": "845457dc-4bb2-4815-bef3-8628ebd1952e",
"siteId": "contoso.sharepoint.com,bf6fb551-d508-4946-a439-b2a6154fc1d9,65a04b8b-1f44-442b-a1fc-9e5852fb123c",
"status": "removeRequested",
"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": "User1@contoso.com",
"id": "845457dc-4bb2-4815-bef3-8628ebd1952e",
"displayName": "User1"
}
},
"lastModifiedDateTime": "2015-06-19T12:01:03.45Z",
"error": null
}
]
}