Mettre à jour sharePointProtectionPolicy
Espace de noms: microsoft.graph
Mettre à jour une stratégie de protection SharePoint. Cette méthode ajoute une siteprotectionunit à ou la supprime de la stratégie de protection.
Cette API est disponible dans les déploiements de cloud national suivants.
Service global | Gouvernement des États-Unis L4 | Us Government L5 (DOD) | Chine gérée par 21Vianet |
---|---|---|---|
✅ | ❌ | ❌ | ❌ |
Autorisations
Choisissez l’autorisation ou les autorisations marquées comme moins privilégiées pour cette API. Utilisez une autorisation ou des autorisations privilégiées plus élevées uniquement si votre application en a besoin. Pour plus d’informations sur les autorisations déléguées et d’application, consultez Types d’autorisations. Pour en savoir plus sur ces autorisations, consultez les informations de référence sur les autorisations.
Type d’autorisation | Autorisations avec privilèges minimum | Autorisations privilégiées plus élevées |
---|---|---|
Déléguée (compte professionnel ou scolaire) | BackupRestore-Configuration.ReadWrite.All | Non disponible. |
Déléguée (compte Microsoft personnel) | Non prise en charge. | Non prise en charge. |
Application | BackupRestore-Configuration.ReadWrite.All | Non disponible. |
Requête HTTP
PATCH /solutions/backupRestore/sharePointProtectionPolicies/{sharePointProtectionPolicyId}
En-têtes de demande
Nom | Description |
---|---|
Autorisation | Porteur {token}. Obligatoire. En savoir plus sur l’authentification et l’autorisation. |
Content-Type | application/json. Obligatoire. |
Corps de la demande
Dans le corps de la demande, fournissez une représentation JSON des propriétés suivantes pour mettre à jour l’objet sharePointProtectionPolicy .
Propriété | Type | Description |
---|---|---|
displayName | Chaîne | Nom d’affichage de sharePointProtectionPolicy. Facultatif |
siteProtectionUnits@delta | Collection(siteProtectionUnit) | Collection d’objets siteProtectionUnit à ajouter ou supprimer de sharePointProtectionPolicy. Obligatoire. |
Pour supprimer un siteProtectionUnit de la stratégie, spécifiez l’annotation @removed
dans le corps de la demande pour l’unité de protection avec l’ID de siteProtectionUnit.
Réponse
Si elle réussit, cette méthode renvoie un 200 OK
code de réponse et une sharePointProtectionPolicy mise à jour dans le corps de la réponse.
Pour obtenir la liste des réponses d’erreur possibles, consultez Réponses d’erreur de l’API de stockage de sauvegarde.
Exemples
Demande
L’exemple suivant illustre une demande.
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"
}
]
}
Réponse
L’exemple suivant illustre la réponse.
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
}
]
}