cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
swallbridge
Level: Power Up

Copying file from one SharePoint library to another - no metadata when the payload is a PDF

Hey there,

 

I'm building a Flow where once an item in one library has a condition that changes (paperwork status set to "reconciled", in our case), I then want to move that file to a different library, complete with all of its metadata.  I've tried doing this both as a Copy File action and a Create File (with content) action.  In both cases, this works great with a Word document (.docx) but with a PDF the destination file comes across missing all of its metadata.

 

I thought... okay, I'll just update the properties of that destination file, no biggie. However, as you'll see from the screenshot, the destination file created by the "Copy File" action does not produce an ID I can then reference in the ID field (note, the ID field you see below is for the original source file, not the destination). 

 

This seems like a bug to me, no?

Any help appreciated,

Sean

 

No ID from copied file.png

9 REPLIES 9
Community Support Team
Community Support Team

Re: Copying file from one SharePoint library to another - no metadata when the payload is a PDF

Hi @swallbridge,

 

Could you please share a full screenshot of your flow’s configuration?

Which property that you would like to update with, the file itself, or the added column fields in the Library?

 

If you want to update the property of file itself, please consider take a try to switch “Update file properties” action into “Update file” action:12.JPG

 

If you want to update the property of added column fields in the library, please take a try with the following workaround:

  • Add a “When a file is created or modified (properties only)” trigger.
  • Add “Get file metadata” action, File Identifier field set to Identifier dynamic content of above trigger.
  • Add a “Get file properties” action, specify Site Address and Library Name, Id field set to ID dynamic content of the trigger.
  • Add a Condition, left input box set to Status dynamic content of “Get file properties” action, right input box set to reconciled, within middle drop down, choose is equal to.
  • Within “If/yes” branch of “Condition”, add a “Copy file” action, then add a “Get files (properties only)” action, specify Site Address, Library Name set to another different library on your side.

 

Add a Condition 2, click “Edit in advanced mode”, type the following formula:

 

@equals(body('Get_file_metadata_2')?['DisplayName'], body('Get_file_metadata')?['DisplayName'])

 

 

Within “If/yes” branch of Condition 2, add a “Update file properties” action, Id field set to ID dynamic content of “Get files (properties only)” action.

 

Image reference:13.JPG

 

14.JPG

 

15.JPG

 

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
swallbridge
Level: Power Up

Re: Copying file from one SharePoint library to another - no metadata when the payload is a PDF

Hi @v-xida-msft,

 

Many thanks for the thoughtful response.  Below is my current flow with where I'm stuck trying to get the ID. I did try your suggestions (apply to each, etc.) but I seem to get the same result in the end, being unable to get the ID of the destination/copied file.  I'd prefer not to do the "update file" as now I'm mucking with blobs, but even when I did try it, I was still unable to get the ID of the destination.

 

Thanks in advance for any further suggestions. I know I'm close and this could very well be a very repeatable scnerio for customers - moving (copying/deleting) a file from a source SharePoint to a different library is a very common request I find.

 

Sean

 

full flow screenshot.png

Super User
Super User

Re: Copying file from one SharePoint library to another - no metadata when the payload is a PDF

Hi @swallbridge,

 

I realize this is a fairly old post and I imagine you've figured this out by now, but I ran across the thread when I was looking for something else, so I thought I'd pass along what I've done in your scenario.

 

In your most recent screenshot, where you're looking for the Id to enter in the Update File Properties action, but it's not available in the Dynamic Content, try this: In the Expression builder, enter (by typing)

body('Copy_file_-_pending_to_archives_library')?['ItemId']

The key being that I think it's ItemId you want, but you have to enter an expression to get at it.

 

- Sandy

 



Did I answer your question? Mark my post as a solution!

Proud to be a Flownaut!


swallbridge
Level: Power Up

Re: Copying file from one SharePoint library to another - no metadata when the payload is a PDF

Thanks for sharing Sandy. I had parked this as I had a decent workaround (but not a great one). I’m on vacation but will revisit this next week. Thanks for taking the time to share.

Super User
Super User

Re: Copying file from one SharePoint library to another - no metadata when the payload is a PDF

@swallbridge,

 

Did you ever resolve?

Super User
Super User

Re: Copying file from one SharePoint library to another - no metadata when the payload is a PDF

It looks like the action "Get file metadata using path" works great for this situation.  Immediately following the copy, you can reach out to your new file, and pull in the ID.  Perhaps this action was not around back when this thread was started.

 

image.png

Administrator
Administrator

Re: Copying file from one SharePoint library to another - no metadata when the payload is a PDF

Hello, @swallbridge!

 

Thank you for posting on the Flow Community Forum! Have you had an opportunity to apply @martinav‘s recommendation to adapt your Flow? If yes, and you find that solution to be satisfactory, please go ahead and click “Accept as Solution” so that this thread will be marked for other users to easily identify!


Thank you for being an active member of the Flow Community!

 

-Gabriel
Flow Community Manager

-Gabriel
Microsoft Flow Community Manager
Super User
Super User

Re: Copying file from one SharePoint library to another - no metadata when the payload is a PDF

I have recently learned that the Copy File action itself now returns the DESTINATION file ID if you do a Get File Metadata first.  That makes this a non-issue now as well.  You have two options.

image.png

 

 

 

Administrator
Administrator

Re: Copying file from one SharePoint library to another - no metadata when the payload is a PDF

Hello, @swallbridge!

 

Thank you for posting on the Flow Community Forum! Have you had an opportunity to apply @martinav‘s recommendation to adapt your Flow? If yes, and you find that solution to be satisfactory, please go ahead and click “Accept as Solution” so that this thread will be marked for other users to easily identify!


Thank you for being an active member of the Flow Community!

 

-Gabriel
Flow Community Manager

-Gabriel
Microsoft Flow Community Manager

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Watch the event on demand for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 Release Wave 2 Plan

Power Platform 2019 Release Wave 2 Plan

Features releasing from October 2019 through March 2020.

thirdimage

Flow Community User Group Member Badge

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

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Flow Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 379 members 4,242 guests
Please welcome our newest community members: