Copying OneDrive Documents

In this article

    You can copy backed-up OneDrive documents to another location in Microsoft OneDrive.

    Request

    POST https://<hostname>:4443/v6/RestoreSessions/{restoreSessionId}/Organization/OneDrives/{oneDriveId}/Documents/copyTo

    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.

    oneDriveId

    string

    Specifies the identification number of OneDrive. For more information on how to get this parameter, see Getting OneDrive Items.

    Request Body

    To copy backed-up OneDrive documents to a different production server, the request body must contain the following properties:

    Property

    Type

    Description

    documents

    document[]

    Accepts IDs of documents that you want to copy. For more information on how to get such IDs, see Getting OneDrive Documents.

    userName

    string

    Specifies the user name that you want to use for authenticating to the organization.

    Example: "userName": "jsmith@westsupport.onmicrosoft.com".

    userPassword

    string

    Specifies the password of the user account that you want to use for authenticating to the organization.

    Example: "userPassword": "paSSw0rd".

    oneDrive

    oneDrive

    Specifies the target OneDrive copy destination.

    folder

    folder

    Specifies the target OneDrive folder copy destination.

    documentVersion

    documentVersion

    Specifies, which of the following versions of the OneDrive documents will be copied:

    • all
    • last

    documentLastVersionAction

    documentLastVersionAction

    Specifies, which one of the following actions will be performed with the last version of the copied OneDrive documents on the destination server:

    • overwrite
    • merge

    For example:

    Request Body:

    {

      "userName": "djohnes@northsupport.onmicrosoft.com",

      "userPassword": "paSSw0rd",

      "documents":  [

         {"Id": "74685f6b-16aa-4a78-a44f-05526ce0ae30"},

         {"Id": "70013a9e-c446-429d-aa78-9c8c20d9b814"}

         ]

    }

    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

    None.

    Example

    The following request copies OneDrive documents.

    Request:

    POST https://abc.tech.local:4443/v6/RestoreSessions/61954db6-7278-4d26-86f7-888bda5a4ec4/Organization/OneDrives/b3184e77-b95b-45f7-96cc-180a20b61cbd8507931c-4561-4ddf-bc90-411aba44bb39/Documents/copyTo

     

    Request Header:

    Authorization: Bearer <Access-Token>

     

    Request Body:

    {

      "documents" :

      [

       {

       "sizeBytes": 80101,

       "inheritedPermissions": true,

       "version": "1.0",

       "id": "0e4079a2-faa5-41bf-b8a7-ba883308cbc9",

       "name": "Content1.jpg",

       "createdBy": "System Account",

       "creationTime": "2017-04-09T09:12:59",

       "modifiedBy": "System Account",

       "modificationTime": "2017-04-09T09:12:59",

       "_links": {

        "self": {

         "href": "v6/RestoreSessions/61954db6-7278-4d26-86f7-888bda5a4ec4/organization/onedrives/b3184e77-b95b-45f7-96cc-180a20b61cbd8507931c-4561-4ddf-bc90-411aba44bb39/documents/0e4079a2-faa5-41bf-b8a7-ba883308cbc9"

        },

        "onedrive": {

         "href": "v6/RestoreSessions/61954db6-7278-4d26-86f7-888bda5a4ec4/organization/onedrives/b3184e77-b95b-45f7-96cc-180a20b61cbd8507931c-4561-4ddf-bc90-411aba44bb39"

        },

        "parent": {

         "href": "v6/RestoreSessions/61954db6-7278-4d26-86f7-888bda5a4ec4/organization/onedrives/b3184e77-b95b-45f7-96cc-180a20b61cbd8507931c-4561-4ddf-bc90-411aba44bb39/folders/89e2b52a-66e3-4a1a-a088-4655dfbe95d7"

        }

       }

      },

      {

       "sizeBytes": 1040384,

       "inheritedPermissions": true,

       "version": "2.0",

       "id": "206b13cc-a453-4102-a256-20a64f760e6d",

       "name": "Content2.png",

       "createdBy": "System Account",

       "creationTime": "2017-12-26T12:07:30",

       "modifiedBy": "System Account",

       "modificationTime": "2017-12-26T12:07:30",

       "_links": {

        "self": {

         "href": "v6/RestoreSessions/61954db6-7278-4d26-86f7-888bda5a4ec4/organization/onedrives/b3184e77-b95b-45f7-96cc-180a20b61cbd8507931c-4561-4ddf-bc90-411aba44bb39/documents/206b13cc-a453-4102-a256-20a64f760e6d"

        },

        "onedrive": {

         "href": "v6/RestoreSessions/61954db6-7278-4d26-86f7-888bda5a4ec4/organization/onedrives/b3184e77-b95b-45f7-96cc-180a20b61cbd8507931c-4561-4ddf-bc90-411aba44bb39"

        },

        "parent": {

         "href": "v6/RestoreSessions/61954db6-7278-4d26-86f7-888bda5a4ec4/organization/onedrives/b3184e77-b95b-45f7-96cc-180a20b61cbd8507931c-4561-4ddf-bc90-411aba44bb39/folders/67cdafbf-8c14-434e-a02d-a04f228e0086"

        }

       }

      }

      ],

      "userName" : "admin",

      "userPassword" : "12345678",

      "documentVersion" : "all",

      "folder" : "pictures",

      "oneDrive" : {

       "id": "724011c3-a540-4684-b24f-3e2ab4ef6380df26ea7d-6468-4846-bdf5-4e88d871ed11",

       "name": "CopyTo User",

       "url": "http://server/personal/orgUser",

       "_links": {

        "self": {

         "href": "v6/organizations/a602e179-a821-4544-b653-f4aa03b39817/users/00000000-0000-0000-0000-000000000000d6d5c441-6c14-411a-9147-53f31a16d225AQUAAAAAAAUVAAAApgPzBIixQ2kafNW0dAQAAA==/onedrives/724011c3-a540-4684-b24f-3e2ab4ef6380df26ea7d-6468-4846-bdf5-4e88d871ed11"

        },

        "user": {

         "href": "v6/organizations/a602e179-a821-4544-b653-f4aa03b39817/users/00000000-0000-0000-0000-000000000000d6d5c441-6c14-411a-9147-53f31a16d225AQUAAAAAAAUVAAAApgPzBIixQ2kafNW0dAQAAA=="

        }

       }

      }

    }

     

    Response:

    200 OK