cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Gaëlle
Level 8

Big emergency question : Copy File from SharePoint : are IDs copied ??

Hello everyone !

I have a reaaally big question.


SharePoint Online, MS Flow :

 

I have created Site Pages on Site A and on Site B.

On Site B SitePages Library, I have IDs going up to 135.

Then, in a "Apply to each" loop, running through a SP List with SP Sites URLs, I am copying a SitePage from one Site A to another Site B.
In Flow, I am using the SharePoint Action "Copy File" with the settings below :

 

flow_copyFile.PNG

 

On Site A, my original SitePage has the ID 67.

On Site B, my copied SitePage also has the ID 67.

 

Here are my really important questions :

  • How does Copy file check if another file is already there ? Does it check for the same name  (aka the MySitePages.aspx ) ? For the same ID ?
  • Does it copy and force the ID from the original one ? It seems to be that way with the "replace".

I tried with the "Copy file with a new name", and on my Site B, the copied/pasted SitePage increments the IDs as usual : now I have ID 136. BUT, I also have 2 pages with the same title but with different names.

This solution is not effective, because : what if the flow -which is running with a "apply to each" on a list of Sites- fails ?
I mean, it fails on 2-3 sites. I want to re-run it, so it will try to copy again on sites it already succeeded. I will have several pages with the same title but different names and IDs....

So, please tell me if my interpretations of CopyFile are accurate and telle me your solutions / workarounds

Thanks !
Gaëlle, forever grateful to who teaches me something.

 

3 REPLIES 3
Community Support Team
Community Support Team

Re: Big emergency question : Copy File from SharePoint : are IDs copied ??

Hi @Gaëlle,

 

I have tested on my side and reproduced your issue, it's truly will copy original SitePage ID to the destination SitePage.

There are two situations:

1. Copy original SitePage with name test.aspx and ID is 10 to destination Site, replace if another file is already there, the site page name will be test.aspx and ID will be 10.

2. Copy original SitePage with name test.aspx and ID is 10 to destination Site, copy with a new name if another file is already there, the site page name will be test1.aspx and ID will change.

 

The answer to two questions:

  • Copy file checks if another file is here according to the Filename, not the ID.
  • It will copy ID from the original sitepage if there is no ID exist in the destination site. If there has, it will be set with a new ID.

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.

Gaëlle
Level 8

Re: Big emergency question : Copy File from SharePoint : are IDs copied ??

Hello @v-litu-msft !
First, thank you for your answer, I figured it out myself too.

But yes, as you said, the ID are replaced. And I am really concerned about "Will it replace the content of the page with existing ID with the new content?" Flow/SP only checks for name...

To prevent any unwanted behavior, I tried to add a Get file content using Path to check if the SitePage already exists.
Then I added 2 parallel branches for copying :

  • One is running after the Get file content using Path aciton fails. It means the file were not found, so I can copy the original page "safely" with the setting "Copy with a new name"
  • One is running after the Get file content using Path action successes. It means there is already a file with the same name, so I copy the original page by replacing the content (with the setting "replace"). I have set this one as well for two reasons:
    • After publication and copy/past to other sites, the users wants to modify the original page's content. And then, they want the changes to replicate in all the pages previously copied/pasted.
    • The flow fails somewhere, on one site for example, so the users re-submit it. It won't create zillions of pages with the same content but different names.

But this brings a new and different problem :

When the "Get file content using Path" action fails, my following actions are well ran, and they succeed. BUT, my Flow's run status is set to FAIL. I don't want to scare my users nor I want them to file bugs everytime they see the flow failing, because it is an intended failure.
Do you have a workaround for me please ?

Thanks!

Highlighted
Community Support Team
Community Support Team

Re: Big emergency question : Copy File from SharePoint : are IDs copied ??

Hi @Gaëlle,

 

Though the ID exists in the destination site, the copied file will still set a new ID.

However, your method is brilliant, I don't know about your Flow structure, if you want an action failed, flow still run and status is successful, maybe you want this feature:

Annotation 2019-10-02 175713.png

 

Annotation 2019-10-02 175726.png

Only the previous action failed, the Compose will perform, I hope it can help you.

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
firstImage

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

firstImage

Incoming: New and improved badges!

Look out for new contribution recognition badges coming SOON!

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!

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Solution Authors
Top Kudoed Authors
Users online (5,491)