cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
XAEA12
Frequent Visitor

Move SharePoint Online files to another site collection while preserving folder structure

Fairly new to PA...

 

I am trying to create a flow that will move files from a site collection to another while preserving the folder structure (e.g. Shared Documents/Folder/Folder/File). Both site collections have the same folder structure.

I created the following workflow, but the problem is that if I filter the query (ContentType ne 'Folder')

by trying to pull only documents (docx, xlsx, pdf, pptx) it will only move the pdfs.

Any ideas?

 

 

1.PNG
2.PNG
3.PNG
1 ACCEPTED SOLUTION

Accepted Solutions
v-litu-msft
Community Support
Community Support

Hi @XAEA12,

 

You could use Copy Folder action, it will preserve files and folder structure:

Annotation 2020-05-27 173507.jpg

 

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

View solution in original post

5 REPLIES 5
SylvieLet17
Responsive Resident
Responsive Resident

Weird!

@XAEA12 (nice name) I made a test on my end, with the same Odata query filter, but I am just using the out of the box "Move File" action, instead of the Send an HTTP request action and it works fine. 

 

It moved all of my documents (including PDFs, .docx, .xlsx, .ppt and even .url) but it left the folders. Is there any reason you need the HTTP request action? 
Is this for archiving? Is that the purpose of the Flow? - asking because I am working on similar ideas for archiving/publishing to intranet sites etc. 

v-litu-msft
Community Support
Community Support

Hi @XAEA12,

 

You could use Copy Folder action, it will preserve files and folder structure:

Annotation 2020-05-27 173507.jpg

 

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

View solution in original post

@v-litu-msft , but will that keep the version history?

Seems like OP wants to keep the version history, and Copy File (not sure about folder) does not keep it as far as I know. 

Yes, the end goal would be to have an archiving solution, on the site level.

 

Indeed, it's curious that the api won't work as expected, I thought that it's a bit more flexible.

 

I used the Move file, but had to adapt the dynamic content output as the FolderPath from Get Files(Properties only) looks like: Shared Documents/ Folder/ but the move requires the path: /Shared Documents/Folder.

 

Like this it works as it picks up even Shared Documents/Folder/Folder/Folder/File

 

4.PNG

Hi @XAEA12 @SylvieLet17 ,

 

The copied files couldn't the original version, the version history only keep when these files are moved to some folders:

https://www.cognillo.com/blog/copy-a-list-in-sharepoint-or-office-365/

 

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

Helpful resources

Announcements
MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

Top Solution Authors
Users online (86,788)