cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper I
Helper I

Copy a library folder structure to a newly created library

Hi everyone, hope everyone is doing well and staying safe.

 

Here's my issue.

 

I'm trying to automate creating a document library and populating this library based on a folder structure.

I create the library with a HTTP Call to SP and that works well.

but when I go to copy the folders I want into that new library I get error "

 

even though the library was created successfully.

 

screenshots belowAutomateProject1.JPG

 

AutomateProject2.JPG

 

AutomateProject3.JPG

 

I get the same result when I use "Copy Folder" instead of "Copy File".

Is there a better way to copy a folder structure from a library to another dynamically or I'm missing something with this method?

 

Thanks in advance

8 REPLIES 8
Highlighted
Super User II
Super User II

Re: Copy a library folder structure to a newly created library

Hi @DemoMan 

Try after adding "/" to Destination folder , as below:

filesave.jpg

Regards

Highlighted
Helper I
Helper I

Re: Copy a library folder structure to a newly created library

Hi @DeepakS  Thanks for the quick reply,

 

I seem to be getting the same error:

 

AutomateProject4.JPG

 what do you think?

Highlighted
Community Support
Community Support

Re: Copy a library folder structure to a newly created library

 

Hi @DemoMan ,

 

Please try the following configuration.

 

  • Use List folder action to get the folders and files in the root folder.
  • Determine whether the current item is a folder or a file, and then use Copy folder and Copy file action to process separately.
  • Enter "/NewLibraryName" in the Destination Folder.

 

An error will be encountered when Flow is executed. The error will be encountered when moving the Forms folder. This error can be ignored. Because each library has a Form folder by default, there is a conflict here.

 

Image reference:

Spoiler
167.PNG

 

Hope this helps.

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Helper I
Helper I

Re: Copy a library folder structure to a newly created library

Hi @v-bacao-msft 

 

Thanks for your reply,

 

The flow ends up timing out, the http request creates the library but it doesn't add the folders in it.

Highlighted
Helper I
Helper I

Re: Copy a library folder structure to a newly created library

When I create the library manually and hard code the library name into the flow, it works.

is there really not a way to copy/move folders/files to a URL created dynamically?

Highlighted
Community Support
Community Support

Re: Copy a library folder structure to a newly created library

 

Hi @DemoMan ,

 

You only need to fill a correct Library Name in Destination Folder. Like /LibraryName.

 

Since that you have used Parse JSON to parse the HTTP response, you could get the correct library Name.

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Helper I
Helper I

Re: Copy a library folder structure to a newly created library

Hi @v-bacao-msft 

 

Thanks for your reply.

 

I tried using the library name out of the JSON parse and I got the same result.

Highlighted
Community Support
Community Support

Re: Copy a library folder structure to a newly created library

 

Hi @DemoMan ,

 

Please try to use Get folder metadata action to get the path of the newly created Library root directory to verify the existence of Folder.

18.PNG

I think the method I provided can Copy a library folder structure to a library. It seems that the problem is with your newly created library.

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
firstImage

Super User Program Update

Three Super User rank tiers have been launched!

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

Top Solution Authors
Top Kudoed Authors
Users online (9,602)