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

On file properties modified, move file from one sharepoint library to another

I have found a few answers on simply moving a file from one library to another and it looks perfect. My issue is that it only works when a file is newly created. I need this to trigger when the file properties are modified (user is checking a box saying "yes, move this").

 

I've created this template from scratch and simply cannot get the copy to work:

 

Trigger: When a file is created or modified (properties Only)

Condition: When metadata field = true (this works right now)

Action: Copy File (this does not work)

Action/Site Address: https://thisismysite.com/sites/tds

Action/Source File Path: I have tried using [URL], [Link to File] and https://thisismysite.com/sites/tds/[Name]. Nothing works! [File Path] is not an option for me for some reason, it doesn't show up in my context menu, only [Folder Path] does.

Action/Destination File Path: https://thisismysite.com/sites/tds/subsite/doclibraryname/[Name]

 

I'm tearing my hair out here, please help!

 

 

 

6 REPLIES 6
Community Support Team
Community Support Team

Re: On file properties modified, move file from one sharepoint library to another

Hi @PSP,

 

Please switch the Copy file action to Create File Action.

See if that would make it work.

 

Regards,

Michael

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
theBIMtractor
Level: Powered On

Re: On file properties modified, move file from one sharepoint library to another

Hi Michael, I've got this part working (the file copy using the Create New) but always need to do some string manipulations to extract the file extension and add this onto the new file. Is this normal?

 

Also, when using this method none of the file properties in the Sharepoint columns are recreated in the new file. I'm at a loss how to replicate the new file with the original files column values as none of the available actions seem to expose an ID to the newly created file.

theBIMtractor
Level: Powered On

Re: On file properties modified, move file from one sharepoint library to another

Hi @v-micsh-msft, I've got this part working (the file copy using the Create New) but always need to do some string manipulations to extract the file extension and add this onto the new file. Is this norm

 

Also, when using this method none of the file properties in the Sharepoint columns are recreated in the new file. I'm at a loss how to replicate the new file with the original files column values as none of the available actions seem to expose an ID to the newly created file.

BigShotRob
Level: Powered On

Re: On file properties modified, move file from one sharepoint library to another

Sorry to revive this thing, but I'm wondering what you did to get that file extension, I'm finding myself in the same boat here and can't seem to get it to work properly, when it copies the file to the new library, it does so without an extension.

theBIMtractor
Level: Powered On

Re: On file properties modified, move file from one sharepoint library to another

@BigShotRob, like I said its a very contorted process.

Step 1 - find the last '.' before the file extension in the 'Identifier' property and store this as an integer variable 'intDot'

lastIndexOf(body('Get_file_properties')?['{Identifier}'],'.')
 
Step 2 - get the length of the 'Identifier' string and store this as another integer variable 'intLen'
length(body('Get_file_properties')?['{Identifier}'])
 
Step 3 - use the above variables to substring out the file extension and store this as string variable 'strFileExtn'
substring(body('Get_file_properties')?['{Identifier}'],variables('intDot'),sub(variables('intLen'),variables('intDot')))
 
Now you can concat the file name with the file extension.
 
Please, someone tell me there is an easier way!!
BigShotRob
Level: Powered On

Re: On file properties modified, move file from one sharepoint library to another

@theBIMtractorthank you for your help - I can honestly say there's no way I would have figured this out. That being said, I'm going to give this a shot tomorrow to see if I can get it working.

 

"Please, someone tell me there is an easier way!!"

 

I cannot believe this is really how it's to be done, to think that THIS made it through Microsoft QA and they GA'd this connector when things like this can't do a simple copy document is absolutely mind blowing.

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Join us 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: 47 members 4,961 guests
Please welcome our newest community members: