| title | Update exchangeProtectionPolicy |
|---|---|
| description | Update an Exchange protection policy. |
| author | tushar20 |
| ms.reviewer | manikantsinghms |
| ms.localizationpriority | medium |
| ms.subservice | m365-backup-storage |
| doc_type | apiPageType |
| ms.date | 08/26/2024 |
Namespace: microsoft.graph
[!INCLUDE beta-disclaimer]
Update an Exchange protection policy. This method adds a mailboxprotectionunit to or removes it from the protection policy.
[!INCLUDE national-cloud-support]
Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions only if your app requires it. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference.
[!INCLUDE permissions-table]
PATCH /solutions/backupRestore/exchangeProtectionPolicies/{exchangeProtectionPolicyId}| Name | Description |
|---|---|
| Authorization | Bearer {token}. Required. Learn more about authentication and authorization. |
In the request body, provide a JSON representation of the following properties to update the exchangeProtectionPolicy object.
| Property | Type | Description |
|---|---|---|
| displayName | String | Display Name of the exchangeProtectionPolicy. Optional. |
| mailboxProtectionUnits@delta | Collection(mailboxProtectionUnit) | Collection of mailboxProtectionUnit objects to be added to or removed from the Exchange protection policy. Required. |
To remove a mailboxProtectionUnit from the policy, specify the @removed annotation in the request body for the protection unit together with the ID of the mailboxProtectionUnit.
If successful, this method returns a 200 OK response code and an updated exchangeProtectionPolicy object in the response body.
For a list of possible error responses, see Backup Storage API error responses.
The following example shows a request.
PATCH https://graph.microsoft.com/beta/solutions/backupRestore/exchangeProtectionPolicies/845457dc-4bb2-4815-bef3-8628ebd1952e
Authorization: Bearer <Access-Token>
{
"displayName": "Exchange Policy - Inadvertent data loss",
"mailboxProtectionUnits@delta": [
{
"directoryObjectId": "1b014d8c-71fe-4d00-a01a-31850bc5b32c"
},
{
"directoryObjectId": "2b014d8c-71fe-4d00-a01a-31850bc5b32c"
},
{
"@removed": {
"reason": "changed"
},
"id": "99954f18-c8ec-4b62-85bf-cdf3b70b140e"
},
{
"@removed": {
"reason": "changed"
},
"id": "4267e382-71a9-4c07-bef7-bda97e09c0d2"
}
]
}[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
The following example shows the response.
Note: The response object shown here might be shortened for readability.
HTTP/1.1 200 OK
{
"displayName": "Exchange Policy - Inadvertent data loss",
"mailboxProtectionUnits@delta": [
{
"id": "89014d8c-71fe-4d00-a01a-31850bc5b32c",
"policyId": "845457dc-4bb2-4815-bef3-8628ebd1952e",
"directoryObjectId": "1b014d8c-71fe-4d00-a01a-31850bc5b32c",
"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"
},
{
"id": "67014d8c-71fe-4d00-a01a-31850bc5b32c",
"directoryObjectId": "2b014d8c-71fe-4d00-a01a-31850bc5b32c",
"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"
},
{
"id": "99954f18-c8ec-4b62-85bf-cdf3b70b140e",
"directoryObjectId": "7b014d8c-71fe-4d00-a01a-31850bc5b32c",
"policyId": "845457dc-4bb2-4815-bef3-8628ebd1952e",
"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 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"
}
]
}