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

need a way to copy file across all site collections starting with specific word

Hello Everyone,

 

I bit confused how to create a flow which can copy from a main site collection → library → folder → file.vsdx to 100 other sites under a specific location. 

 

ex: when a specific file under domaintest.sharepoint.com/sites/sitecollection → folder →filevsdx is modified then flow should trigger and copy that modified file across all the other site collections that started with domaintest.sharepoint.com/sites/ON-

so any site that starts as "ON-" after the /sites then it should copy file under a library. 

 

I am not sure about the steps exactly. can someone provide an insight on this? 

 

steps:

1. when a file is created or modified in a folder(SharePoint). 

2. copy file (SharePoint) 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User
Super User

Re: need a way to copy file across all site collections starting with specific word

Hey @kumarraj88 ,

Yes it works 🙂

I have configured the SharePoint list as follows:

1.png

 The calculated column example:

2.png

Example List Item:

5.png

 The Flow configuration:

3.pngRun history:

 4.png

 

HTH

Jay

-------------------------------------------------------------------------

If I have answered your question, please mark your post as Solved.

If you like my response, please give it a Thumbs Up

View solution in original post

13 REPLIES 13
Highlighted
Super User
Super User

Re: need a way to copy file across all site collections starting with specific word

Hi @kumarraj88 

The primary challenge is obtaining a list of the possible site collections... there isn't a standard power automate action which retrieves all site collections, you could add a HTTP request to query to the graph... and then filter the returned JSON array as needed.

Or simpler... just create a list in SharePoint which holds all the site you wish to copy the file to, you could optionally also store the folder path in the list as well the site url, quick example below:

1.png

 HTH

Jay

-------------------------------------------------------------------------

If I have answered your question, please mark your post as Solved.

If you like my response, please give it a Thumbs Up

Highlighted
Helper III
Helper III

Re: need a way to copy file across all site collections starting with specific word

thanks @Jay-Encodian  for quick reply. I have a list all of the site collection URL under a column called "URL". I can use that as my site collection and can copy the file right?

 

AT the destination I am using a library. so do I need to mention destination folder name as "library name" ?

Highlighted
Super User
Super User

Re: need a way to copy file across all site collections starting with specific word

Hey @kumarraj88 

Yeah, that’s how I configured the example Flow... I was suggesting you could also add a ‘Folder Path’ column to the list which would allow you to cater for different file path locations across the sites.

 

Highlighted
Helper III
Helper III

Re: need a way to copy file across all site collections starting with specific word

@Jay-Encodian thank for your suggestion. The list that I have will be update on a regular basis and we get new sites created every now and then. So I have to set the column as calculated column so that whenever a URL has been added to the list then this calculated column should path library called "testing". 

 

ex: URl column =  domin.sharepoint.com/sites/on-10101 then calculated column should auto populatwith URL along with "/testing " library. 

 

so do I need to add calculated formula as =column +'/testing' ?

Highlighted
Super User
Super User

Re: need a way to copy file across all site collections starting with specific word

Hey @kumarraj88 

You should a list containing two text columns... URL and ‘Folder Path’

Just add a new entry for every site and set the values, there shouldn’t be any need to calc values, just ensure the full URL and Folder Paths are added for each list item 

Highlighted
Helper III
Helper III

Re: need a way to copy file across all site collections starting with specific word

@Jay-Encodian well the issue is that end user will add new items along with and URL of a site. They won't add  complete path of the library..   so whenever they add new entry in the list, based up on the URL entered it should auto populate new column with complete library path. 

 

If it is one time setup, then yes I agree having two column with the details already populated will work without any issue. 

 

Due to this I was thinking to add calculated column so that it can auto populate complete URL based up every new entry

Highlighted
Super User
Super User

Re: need a way to copy file across all site collections starting with specific word

Hey @kumarraj88 

I understand, but if your auto setting to a calculated value.... then I don’t think you need the column? If it will always be a consistent path you can hard code the folder path in the flow and negate adding the column in your SharePoint list. You can always add later if you need to

Highlighted
Helper III
Helper III

Re: need a way to copy file across all site collections starting with specific word

hi @Jay-Encodian , thanks for the idea. Yes, it is always the same so we can hard-code it in the flow. testing it now

Highlighted
Helper III
Helper III

Re: need a way to copy file across all site collections starting with specific word

hi @Jay-Encodian , no luck. The column that I am using is an calculated column. so it is not picking the URL at all.  the reason why it is calculated column is because when my user enter a asset number, calculated column will be auto-populated with and URL constructing and patching with that asset number. this entire URL will be used to create a site collection. 

can flow pick the URL from a calculated column? 

 

Highlighted
Super User
Super User

Re: need a way to copy file across all site collections starting with specific word

@kumarraj88 

Much simpler 🙂

just type in the Folder path in the ‘Destination Folder’ property of the ‘Copy file’ action

Highlighted
Super User
Super User

Re: need a way to copy file across all site collections starting with specific word

Hey @kumarraj88 

It’s coming up to 11pm here, I’ll check in the morning ref calculated column

Highlighted
Super User
Super User

Re: need a way to copy file across all site collections starting with specific word

Hey @kumarraj88 ,

Yes it works 🙂

I have configured the SharePoint list as follows:

1.png

 The calculated column example:

2.png

Example List Item:

5.png

 The Flow configuration:

3.pngRun history:

 4.png

 

HTH

Jay

-------------------------------------------------------------------------

If I have answered your question, please mark your post as Solved.

If you like my response, please give it a Thumbs Up

View solution in original post

Highlighted
Helper III
Helper III

Re: need a way to copy file across all site collections starting with specific word

@Jay-Encodian, thanks you for testing it. I was able to fix it yesterday night by making small change. Instead of using calculated column with the URL, I have hardcoded URL until "ON-" and then used another column which is the site Name. Based up on that it was able to find out the location and was able to copy it. 

 

ex: Asset Number: 101010 (this a list column), then SharePoint site we are creating is called domain.sharepoint.com/sites/ON-101010.

 

So in the destination URL I have used like this  "domain.sharepoint.com/sites/ON-column".

 

 

Helpful resources

Announcements
firstImage

Now Live: Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

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 (7,240)