web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / How to copy or move do...
Power Automate
Unanswered

How to copy or move document sets from one library to another in SharePoint using Power Automate

(1) ShareShare
ReportReport
Posted on by 71
I have 2 libraries with the same content type for document sets.
I'm trying to move the document set from one library to another (Active and Archive)
 
I'm using the action "Send an HTTP request to SharePoint"
 
Here's the setup I have
 
method = post
uri = /_api/site/CreateCopyJobs
headers:
Accept - application/json;odata=verbose
Content-Type - application/json;odata=verbose
Json:
{
  "exportObjectUris": ["https://<tenantname>.sharepoint.com/sites/<sitename>/<library>/<doc set name>"],
  "destinationUri": "https://<tenantName>/sites/<sitename>/<archive library>/",
  "options": {
    "IgnoreVersionHistory": false,
    "IsMoveMode": true
}
}
 
I'm getting a 400 bad gateway.
 
 
 
I've tried modifying the JSON Option
{
  "exportObjectUris": ["https://<tenantname>.sharepoint.com/sites/<sitename>/<library>/<doc set name>"],
  "destinationUri": "https://<tenantName>/sites/<sitename>/<archive library>/",
  "options": {
    "IgnoreVersionHistory": false,
    "IsMoveMode": true,
    "AllowSchemaMismatch": true,
    "AllowSmallerVersionLimitOnDestination": true,
    "NameConflictBehavior": "replace",
    "IncludeItemPermissions": false,
    "BypassSharedLock": true,
    "ExcludeChildren": false
  }
}
I get a 400  - Cannot convert a primitive value to the expected type 'Edm.Int32'.
 
 
I am able to move the document set with the move function on the SharePoint Library but can't do it with Power Automate.
 
 
Categories:
I have the same question (0)
  • Michael E. Gernaey Profile Picture
    53,488 Super User 2025 Season 2 on at
     
    Are you required to use the Send HTTP request? Can you leverage the actions directly. Now that question isn't whether it works, I am asking if you can change the approach.
     
    also, can you please share your Flow, with inputs (build mode) and then also in Run mode where you get the errors, so we can see the inputs and outputs of each step to hopefully get more details.
  • MS-03101913-0 Profile Picture
    71 on at
    Hello Michael,
     
    what direct action are you referring to?  I've tried move file and move folder and both error out.
    My flow starts with a "For a selected file" and I chose the document set name in the library.
     
     
    I'm attaching the output of each step as txt files.
     
     
  • MS-03101913-0 Profile Picture
    71 on at
    Here are the other two outputs.
     
  • MS-03101913-0 Profile Picture
    71 on at
    I am essentially following this copilot suggestion:
     

    To perform a complex move of a document set using the CreateCopyJobs API in Power Automate, follow these steps:

    1. Set Up the Flow

    • Start with a trigger, such as "Manually trigger a flow" or "When an item is created or modified."

    2. Send an HTTP Request to SharePoint

    • Use the "Send an HTTP request to SharePoint" action to call the CreateCopyJobs API.

    • Configure the action as follows:

      • Method: POST

      • URI: /_api/site/CreateCopyJobs

      • Headers:

        • Accept: application/json;odata=verbose

        • Content-Type: application/json;odata=verbose

      • Body:

        json
        {
          "exportObjectUris": ["/sites/YourSite/Library/DocumentSet"],
          "destinationUri": "/sites/YourSite/DestinationLibrary",
          "options": {
            "IsMoveMode": true,
            "IgnoreVersionHistory": false,
            "AllowSchemaMismatch": true
          }
        }
        

    3. Monitor the Job

    • The API returns a job ID. Use this ID to monitor the status of the copy/move job.

    • Add another "Send an HTTP request to SharePoint" action to check the job status:

      • Method: GET

      • URI: /_api/site/GetCopyJobProgress(jobId='YourJobID')

    4. Handle Errors

    • Use conditions in Power Automate to handle errors or retries if the job fails.

    Notes:

    • Replace /sites/YourSite/Library/DocumentSet and /sites/YourSite/DestinationLibrary with the actual paths of your source and destination.

    • Ensure you have the necessary permissions to perform these actions.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 519 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 296 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard