cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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
Super User
Super User

Hi @DemoMan 

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

filesave.jpg

Regards

Hi @DeepakS  Thanks for the quick reply,

 

I seem to be getting the same error:

 

AutomateProject4.JPG

 what do you think?

Community Support
Community Support

 

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.

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.

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?

 

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.

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.

 

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
Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

Microsoft Ignite

Microsoft Power Platform: 2021 Release Wave 1 Plan

Power Platform release plan for the 2021 release wave 1 describes all new features releasing from April through September 2021.

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Users online (70,620)