Restoring SharePoint Documents to Original Location
You can restore backed-up SharePoint documents to the original location.
Request
POST https://<hostname>:4443/v6/RestoreSessions/{restoreSessionId}/Organization/Sites/{siteId}/Documents/restore |
Request Headers
The request header must contain an authorization token of the current session.
Request Parameters
The following parameters must be specified in the URL of the request:
Parameter | Type | Description |
---|---|---|
restoreSessionId | string | Specifies the identification number of the restore session. For more information on how to get this parameter, see Getting Restore Sessions. |
siteId | string | Specifies the identification number of the SharePoint site. For more information on how to get this parameter, see Getting Organization SharePoint Sites. |
Request Body
To restore backed-up SharePoint documents to the original location, the request body must contain the following properties:
Property | Type | Description |
---|---|---|
username | string | Specifies the user name that you want to use for authenticating to the SharePoint organization. |
userpassword | string | Specifies the password of the user account that you want to use for authenticating to the SharePoint organization. |
documents | document[] | Specifies the IDs of documents that you want to restore. For more information on how to get such IDs, see Getting SharePoint Documents. |
list | string | Specifies the target SharePoint list. |
restorePermissions | boolean | If set to true, indicates that the SharePoint documents will be restored with all permissions. |
sendSharedLinksNotification | boolean | If set to true, indicates that shared links notifications will be sent. |
documentVersion | documentVersion | Specifies what version of the SharePoint documents will be restored. The following values are available:
|
documentLastVersionAction | documentLastVersionAction | Specifies the action that will be performed with the last version of the restored SharePoint document on the destination server. The following values are available:
|
userCode | string | Specifies the authentication code. For more information on how to get a device code, see Getting Device Code. This property is required if you want to use a device code for data restore. |
applicationId | string | An identification number of the Azure AD application that you want to use for a restore. |
applicationCertificate | base64 | Specifies the SSL certificate configured for the Azure AD application that you want to use for data restore. You must provide the certificate as a Base64 string. For more information on how to obtain a Base64 string, see Converting Certificate to Base64 String. |
applicationCertificatePassword | string | A password for the SSL certificate being used. |
Converting Certificate to Base64 String
If you want to use a certificate to access an Azure AD application, you must provide the certificate as a Base64 string. To obtain a Base64 string, perform the following steps:
- Get the certificate content from a PFX file.
- Convert the certificate to a Base64 string.
To do this, you can use the following PowerShell cmdlets:
$pfx_cert = get-content '<path_to_cert>' -Encoding Byte [System.Convert]::ToBase64String($pfx_cert) | Out-File '<path_to_file>' |
where:
- <path_to_cert> — path to the PFX file that you want to convert to a Base64 string.
- <path_to_file> — path to a file that that will contain the resulting Base64 string. You will be able to copy the Base64 string from the file and provide the string in the body of a request to Veeam Backup for Microsoft 365 REST API.
For example:
$pfx_cert = get-content 'C:\cert.pfx' -Encoding Byte [System.Convert]::ToBase64String($pfx_cert) | Out-File 'C:\base64.txt' |
Request Example 1
The following example shows how to use a user name and password for restore.
Request Body: { "username": "admin@abcsupport.onmicrosoft.com", "userpassword": "paSSw0rd", "list": "list", "restorePermissions": true, "documentVersion": "last", "documentLastVersionAction": "overwrite" "documents": [ {"id": "1cfe4469-0a31-414b-9fd0-e84a087dcb739f242172-6d3f-47a2-816a-4989d45e88dd489d7343-c24d-46f5-978f-0ad62fe4c8703231e17c-2086-4e60-b610-8c5a1871068c"}, {"id": "1cfe4469-0a31-414b-9fd0-e84a087dcb739f242172-6d3f-47a2-816a-4989d45e88dd489d7343-c24d-46f5-978f-0ad62fe4c8704127ac39-dc97-44e2-b5bc-f141f8d0108b"} ] } |
Request Example 2
The following example shows how to use a device code for restore.
Request Body: { "userCode": "C6A9DB737", "list": "list", "restorePermissions": true, "documentVersion": "last", "documentLastVersionAction": "overwrite" "documents": [ {"id": "1cfe4469-0a31-414b-9fd0-e84a087dcb739f242172-6d3f-47a2-816a-4989d45e88dd489d7343-c24d-46f5-978f-0ad62fe4c8703231e17c-2086-4e60-b610-8c5a1871068c"}, {"id": "1cfe4469-0a31-414b-9fd0-e84a087dcb739f242172-6d3f-47a2-816a-4989d45e88dd489d7343-c24d-46f5-978f-0ad62fe4c8704127ac39-dc97-44e2-b5bc-f141f8d0108b"} ] } |
Request Example 3
The following example shows how to use a certificate for restore.
Request Body: { "applicationId" : <app_id>, "applicationCertificate": "MIIKEgIBAzCCCc4GCSqGSIb3DQEHAaCCCb8Eggm7MIIJtzCCBggGCSqGSIb3DQEHAaCCBfkEggX1MIIF8TCCBe0GCyqGSIb3DQEMCgECoIIE/jCCBPowHA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+saXK0TTD7jA7MB8wBwYFKw4DAhoEFKcrbAfmDaDdM8n0qonvDola5JVsBBSOBZavEN2v/i1YfP42r9vRTMqXTwICB9A=", "applicationCertificatePassword": "xxx", "list": "list", "restorePermissions": true, "documentVersion": "last", "documentLastVersionAction": "overwrite", "documents": [ {"id": "1cfe4469-0a31-414b-9fd0-e84a087dcb739f242172-6d3f-47a2-816a-4989d45e88dd489d7343-c24d-46f5-978f-0ad62fe4c8703231e17c-2086-4e60-b610-8c5a1871068c"}, {"id": "1cfe4469-0a31-414b-9fd0-e84a087dcb739f242172-6d3f-47a2-816a-4989d45e88dd489d7343-c24d-46f5-978f-0ad62fe4c8704127ac39-dc97-44e2-b5bc-f141f8d0108b"} ] } |
Response
The server returns the following response to the client.
Response Codes
A successfully completed operation returns a response code 200 OK.
Response Headers
The response to this request contains the following headers. The response may also include additional standard HTTPS headers.
Header | Description |
---|---|
Content-length | The length of the response body. |
Content-type | The media type and syntax of the response body message for the requests with the export and save actions: application/octet-stream. The media type and syntax of the response body message for the requests with the restore and send actions: null. |
Response Body
In the response body, the server returns information about operation results.
Example
The example shows how to restore SharePoint documents to the original location.
Request: POST https://abc.tech.local:4443/v6/RestoreSessions/0ba45909-ce2d-4457-9a41-c466c21cd1e3/Organization/Sites/1cfe4469-0a31-414b-9fd0-e84a087dcb739f242172-6d3f-47a2-816a-4989d45e88dd/Documents/restore
Request Header: Authorization: Bearer <Access-Token>
Request Body: { "documents" : [ { "version": "2.0", "id": "1cfe4469-0a31-414b-9fd0-e84a087dcb739f242172-6d3f-47a2-816a-4989d45e88ddd91646d1-5b4a-468f-8d38-7c2eb3cd057248d332e5-c3f9-4373-9902-beac5510d46a", "name": "request.txt", "createdBy": "System Account", "creationTime": "2021-04-16T12:35:18", "modifiedBy": "System Account", "modificationTime": "2021-04-16T12:37:10", "_links": { "self": { "href": "/v6/RestoreSessions/0ba45909-ce2d-4457-9a41-c466c21cd1e3/organization/sites/1cfe4469-0a31-414b-9fd0-e84a087dcb739f242172-6d3f-47a2-816a-4989d45e88dd/documents/1cfe4469-0a31-414b-9fd0-e84a087dcb739f242172-6d3f-47a2-816a-4989d45e88ddd91646d1-5b4a-468f-8d38-7c2eb3cd057248d332e5-c3f9-4373-9902-beac5510d46a" }, "library": { "href": "/v6/RestoreSessions/0ba45909-ce2d-4457-9a41-c466c21cd1e3/organization/sites/1cfe4469-0a31-414b-9fd0-e84a087dcb739f242172-6d3f-47a2-816a-4989d45e88dd/libraries/1cfe4469-0a31-414b-9fd0-e84a087dcb739f242172-6d3f-47a2-816a-4989d45e88ddd91646d1-5b4a-468f-8d38-7c2eb3cd0572" } } } ], "list" : "exampleList", "username" : "admin", "userpassword" : "password", "restorePermissions" : true, "documentVersion" : "last", "documentLastVersionAction" : "merge" }
Response: 200 OK |