Namespace: microsoft.graph
Important
APIs under the /beta
version in Microsoft Graph are subject to change. Use of these APIs in production applications is not supported. To determine whether an API is available in v1.0, use the Version selector.
Update the properties of a oneDriveForBusinessRestoreSession object.
This API is available in the following national cloud deployments.
Global service |
US Government L4 |
US Government L5 (DOD) |
China operated by 21Vianet |
✅ |
❌ |
❌ |
❌ |
Permissions
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.
Permission type |
Least privileged permissions |
Higher privileged permissions |
Delegated (work or school account) |
BackupRestore-Restore.ReadWrite.All |
Not available. |
Delegated (personal Microsoft account) |
Not supported. |
Not supported. |
Application |
BackupRestore-Restore.ReadWrite.All |
Not available. |
HTTP request
PATCH /solutions/backupRestore/oneDriveForBusinessRestoreSessions/{oneDriveForBusinessRestoreSessionId}
Request body
In the request body, supply only the values for properties to update. Existing properties that aren't included in the request body maintain their previous values or are recalculated based on changes to other property values.
The following table specifies the properties that can be updated.
To remove a drive restore artifact, specify the @removed
annotation in the request body together with the ID of the driveRestoreArtifact object.
Response
If successful, this method returns a 200 OK
response code and an updated oneDriveForBusinessRestoreSession object in the response body.
For a list of possible error responses, see Backup Storage API error responses.
Examples
Request
The following example shows a request.
PATCH https://graph.microsoft.com/beta/solutions/backupRestore/oneDriveForBusinessRestoreSessions/1b014d8c-71fe-4d00-8ab2-31850bc5b32c
{
"driveRestoreArtifacts@delta": [
{
"restorePoint": { "id": "1b014d8c-71fe-4d00-a01a-31850bc5b32c" }, //Create a new drive restore artifact and add it under the Restore Session.
"destinationType": "new"
},
{
"restorePoint": { "id": "2b014d8c-71fe-4d00-a01a-31850bc5b32" },
"destinationType": "new"
},
{
"restorePoint": { "id": "3b014d8c-71fe-4d00-a01a-31850bc5b32c" },
"destinationType": "new"
},
{
"restorePoint": { "id": "4b014d8c-71fe-4d00-a01a-31850bc5b32c" },
"destinationType": "new"
},
{
"@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"
}
]
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
using Microsoft.Kiota.Abstractions.Serialization;
var requestBody = new OneDriveForBusinessRestoreSession
{
AdditionalData = new Dictionary<string, object>
{
{
"driveRestoreArtifacts@delta" , new List<object>
{
new UntypedObject(new Dictionary<string, UntypedNode>
{
{
"restorePoint", new UntypedObject(new Dictionary<string, UntypedNode>
{
{
"id", new UntypedString("1b014d8c-71fe-4d00-a01a-31850bc5b32c")
},
})
},
{
"destinationType", new UntypedString("new")
},
}),
new UntypedObject(new Dictionary<string, UntypedNode>
{
{
"restorePoint", new UntypedObject(new Dictionary<string, UntypedNode>
{
{
"id", new UntypedString("2b014d8c-71fe-4d00-a01a-31850bc5b32")
},
})
},
{
"destinationType", new UntypedString("new")
},
}),
new UntypedObject(new Dictionary<string, UntypedNode>
{
{
"restorePoint", new UntypedObject(new Dictionary<string, UntypedNode>
{
{
"id", new UntypedString("3b014d8c-71fe-4d00-a01a-31850bc5b32c")
},
})
},
{
"destinationType", new UntypedString("new")
},
}),
new UntypedObject(new Dictionary<string, UntypedNode>
{
{
"restorePoint", new UntypedObject(new Dictionary<string, UntypedNode>
{
{
"id", new UntypedString("4b014d8c-71fe-4d00-a01a-31850bc5b32c")
},
})
},
{
"destinationType", new UntypedString("new")
},
}),
new UntypedObject(new Dictionary<string, UntypedNode>
{
{
"@removed", new UntypedObject(new Dictionary<string, UntypedNode>
{
{
"reason", new UntypedString("changed")
},
})
},
{
"id", new UntypedString("99954f18-c8ec-4b62-85bf-cdf3b70b140e")
},
}),
new UntypedObject(new Dictionary<string, UntypedNode>
{
{
"@removed", new UntypedObject(new Dictionary<string, UntypedNode>
{
{
"reason", new UntypedString("changed")
},
})
},
{
"id", new UntypedString("4267e382-71a9-4c07-bef7-bda97e09c0d2")
},
}),
new UntypedObject(new Dictionary<string, UntypedNode>
{
{
"@removed", new UntypedObject(new Dictionary<string, UntypedNode>
{
{
"reason", new UntypedString("changed")
},
})
},
{
"id", new UntypedString("3667e382-71a9-4c07-bef7-bda97e09c0d2")
},
}),
}
},
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Solutions.BackupRestore.OneDriveForBusinessRestoreSessions["{oneDriveForBusinessRestoreSession-id}"].PatchAsync(requestBody);
mgc-beta solutions backup-restore one-drive-for-business-restore-sessions patch --one-drive-for-business-restore-session-id {oneDriveForBusinessRestoreSession-id}
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
OneDriveForBusinessRestoreSession oneDriveForBusinessRestoreSession = new OneDriveForBusinessRestoreSession();
HashMap<String, Object> additionalData = new HashMap<String, Object>();
LinkedList<Object> driveRestoreArtifactsDelta = new LinkedList<Object>();
property = new ();
restorePoint = new ();
restorePoint.setId("1b014d8c-71fe-4d00-a01a-31850bc5b32c");
property.setRestorePoint(restorePoint);
property.setDestinationType("new");
driveRestoreArtifactsDelta.add(property);
property1 = new ();
restorePoint1 = new ();
restorePoint1.setId("2b014d8c-71fe-4d00-a01a-31850bc5b32");
property1.setRestorePoint(restorePoint1);
property1.setDestinationType("new");
driveRestoreArtifactsDelta.add(property1);
property2 = new ();
restorePoint2 = new ();
restorePoint2.setId("3b014d8c-71fe-4d00-a01a-31850bc5b32c");
property2.setRestorePoint(restorePoint2);
property2.setDestinationType("new");
driveRestoreArtifactsDelta.add(property2);
property3 = new ();
restorePoint3 = new ();
restorePoint3.setId("4b014d8c-71fe-4d00-a01a-31850bc5b32c");
property3.setRestorePoint(restorePoint3);
property3.setDestinationType("new");
driveRestoreArtifactsDelta.add(property3);
property4 = new ();
removed = new ();
removed.setReason("changed");
property4.setRemoved(removed);
property4.setId("99954f18-c8ec-4b62-85bf-cdf3b70b140e");
driveRestoreArtifactsDelta.add(property4);
property5 = new ();
removed1 = new ();
removed1.setReason("changed");
property5.setRemoved(removed1);
property5.setId("4267e382-71a9-4c07-bef7-bda97e09c0d2");
driveRestoreArtifactsDelta.add(property5);
property6 = new ();
removed2 = new ();
removed2.setReason("changed");
property6.setRemoved(removed2);
property6.setId("3667e382-71a9-4c07-bef7-bda97e09c0d2");
driveRestoreArtifactsDelta.add(property6);
additionalData.put("driveRestoreArtifacts@delta", driveRestoreArtifactsDelta);
oneDriveForBusinessRestoreSession.setAdditionalData(additionalData);
OneDriveForBusinessRestoreSession result = graphClient.solutions().backupRestore().oneDriveForBusinessRestoreSessions().byOneDriveForBusinessRestoreSessionId("{oneDriveForBusinessRestoreSession-id}").patch(oneDriveForBusinessRestoreSession);
const options = {
authProvider,
};
const client = Client.init(options);
const oneDriveForBusinessRestoreSession = {
'driveRestoreArtifacts@delta': [
{
restorePoint: { id: '1b014d8c-71fe-4d00-a01a-31850bc5b32c' }, //Create a new drive restore artifact and add it under the Restore Session.
destinationType: 'new'
},
{
restorePoint: { id: '2b014d8c-71fe-4d00-a01a-31850bc5b32' },
destinationType: 'new'
},
{
restorePoint: { id: '3b014d8c-71fe-4d00-a01a-31850bc5b32c' },
destinationType: 'new'
},
{
restorePoint: { id: '4b014d8c-71fe-4d00-a01a-31850bc5b32c' },
destinationType: 'new'
},
{
'@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'
}
]
};
await client.api('/solutions/backupRestore/oneDriveForBusinessRestoreSessions/1b014d8c-71fe-4d00-8ab2-31850bc5b32c')
.version('beta')
.update(oneDriveForBusinessRestoreSession);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\OneDriveForBusinessRestoreSession;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new OneDriveForBusinessRestoreSession();
$additionalData = [
'driveRestoreArtifacts@delta' => [
[
'restorePoint' => [
'id' => '1b014d8c-71fe-4d00-a01a-31850bc5b32c',
],
'destinationType' => 'new',
],
[
'restorePoint' => [
'id' => '2b014d8c-71fe-4d00-a01a-31850bc5b32',
],
'destinationType' => 'new',
],
[
'restorePoint' => [
'id' => '3b014d8c-71fe-4d00-a01a-31850bc5b32c',
],
'destinationType' => 'new',
],
[
'restorePoint' => [
'id' => '4b014d8c-71fe-4d00-a01a-31850bc5b32c',
],
'destinationType' => 'new',
],
[
'@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',
],
],
];
$requestBody->setAdditionalData($additionalData);
$result = $graphServiceClient->solutions()->backupRestore()->oneDriveForBusinessRestoreSessions()->byOneDriveForBusinessRestoreSessionId('oneDriveForBusinessRestoreSession-id')->patch($requestBody)->wait();
Import-Module Microsoft.Graph.Beta.BackupRestore
$params = @{
"driveRestoreArtifacts@delta" = @(
@{
restorePoint = @{
id = "1b014d8c-71fe-4d00-a01a-31850bc5b32c"
}
destinationType = "new"
}
@{
restorePoint = @{
id = "2b014d8c-71fe-4d00-a01a-31850bc5b32"
}
destinationType = "new"
}
@{
restorePoint = @{
id = "3b014d8c-71fe-4d00-a01a-31850bc5b32c"
}
destinationType = "new"
}
@{
restorePoint = @{
id = "4b014d8c-71fe-4d00-a01a-31850bc5b32c"
}
destinationType = "new"
}
@{
"@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"
}
)
}
Update-MgBetaSolutionBackupRestoreOneDriveForBusinessRestoreSession -OneDriveForBusinessRestoreSessionId $oneDriveForBusinessRestoreSessionId -BodyParameter $params
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.models.one_drive_for_business_restore_session import OneDriveForBusinessRestoreSession
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = OneDriveForBusinessRestoreSession(
additional_data = {
"drive_restore_artifacts@delta" : [
{
"restore_point" : {
"id" : "1b014d8c-71fe-4d00-a01a-31850bc5b32c",
},
"destination_type" : "new",
},
{
"restore_point" : {
"id" : "2b014d8c-71fe-4d00-a01a-31850bc5b32",
},
"destination_type" : "new",
},
{
"restore_point" : {
"id" : "3b014d8c-71fe-4d00-a01a-31850bc5b32c",
},
"destination_type" : "new",
},
{
"restore_point" : {
"id" : "4b014d8c-71fe-4d00-a01a-31850bc5b32c",
},
"destination_type" : "new",
},
{
"@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",
},
],
}
)
result = await graph_client.solutions.backup_restore.one_drive_for_business_restore_sessions.by_one_drive_for_business_restore_session_id('oneDriveForBusinessRestoreSession-id').patch(request_body)
Response
The following example shows the response.
Note: The response object shown here might be shortened for readability.
HTTP/1.1 200 OK
{
"driveRestoreArtifacts@delta": [
{
"id": "89014d8c-71fe-4d00-a01a-31850bc5b32c",
"restorePoint": { "id": "1b014d8c-71fe-4d00-a01a-31850bc5b32c" },
"destinationType": "new",
"status": "added",
"createdDateTime": "2015-06-19T12:01:03.45Z"
},
{
"id": "67014d8c-71fe-4d00-a01a-31850bc5b32c",
"restorePoint": { "id": "2b014d8c-71fe-4d00-a01a-31850bc5b32c" },
"destinationType": "new",
"status": "added",
"createdDateTime": "2015-06-19T12:01:03.45Z"
},
{
"id": "56014d8c-71fe-4d00-a01a-31850bc5b32c",
"restorePoint": { "id": "3b014d8c-71fe-4d00-a01a-31850bc5b32c" },
"destinationType": "new",
"status": "added",
"createdDateTime": "2015-06-19T12:01:03.45Z"
},
{
"id": "32014d8c-71fe-4d00-a01a-31850bc5b32c",
"restorePoint": { "id": "4b014d8c-71fe-4d00-a01a-31850bc5b32c" },
"destinationType": "new",
"status": "added",
"createdDateTime": "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 restore session does not exist"
},
"failedOperation": "remove",
"responseCode": 409
},
"id": "4267e382-71a9-4c07-bef7-bda97e09c0d2"
}
]
}