cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

If file contains -> create file - condition fails // Sharepoint to OneDrive Business

Hello,

I created a short flow to copy files created on a sharepoint to my Biz One Drive. When adding a contion to copy only files with specific string in the file name, the condition always evaluates to false. 

I need only files which contain "Report" in the name to be moved. 

 

Also, I see when modifying the uploaded file on the sharepoint, the flow says "The file is currently checked out or locked for editing by another user. " and doesn't update the file version. 

 

I have changed the trigger step to "When a file is created or modified..." but get the below:

Request to Azure Resource Manager failed with error: '{"error":{"code":"WorkflowTriggerHistoryNotFound","message":"The workflow '32d842d3-507b-4f64-ac3f-6aa83da870ea' trigger 'When_a_file_is_created_or_modified_in_a_folder' history '08586457716245071125362579330CU99' could not be found."}}'.

 

Any ideas why all the fails ?

 

Thanks!

 

Flow.PNG

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Anonymous ,

The 'Get file content' need to be added before the 'Condition'.

Here the file content is from sharePoint library, so you need use the action 'Get file content (SharePoint)'.

Best Regards,

Community Support Team _ Zhongys

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

7 REPLIES 7
Brad_Groux
Community Champion
Community Champion

It may be worthwhile to review the official documentation for Flow conditions, the SharePoint Online Connector documention and a visual explanation of logical expressions

The problem with the When a file is created trigger, is that it only gives you a handful of operators to work with. Because of this, I almost always use the Get files (properties only) action to expand my list of options.

Spoiler
Get file does not work, because it needs an ID operator, which the When a file is created trigger doesn't offer.  

With that said, I think adding the Get Files (Properties Online) and using the Name string rather than the File name should resolve your issue, as seen below.

Spoiler
Get files adds a loop, so depending on the number of files in the document library, it will check each one of them every time a new file is created, so you may want to add an additional condition to only worry about files uploaded "today". The utcnow expression is how you'd achieve this (date/time formatting). 

Condition.PNG

 

 

v-zhos-msft
Solution Sage
Solution Sage

Hi @Anonymous ,

I have made a test with the 'When a file is created in a folder' trigger.

However the file name will change to code in this trigger, so you 'Condition' will always false.

Capture3.PNG

I suggest you use the 'When a file is created (properties only)' trigger.

Capture2.PNG

Best Regards,

Community Support Team _ Zhongys

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Thanks for the suggestion but If I go for "When a file is created - Properties only" then it seems I can't opt for the "File content"  when I add the Create file action so is there any other way to retrieve that entire file ? 

 

Thank you!

Hi @Anonymous ,

You can add the 'Get file content' action in you flow to get the file content.

Capture.PNGCapture1.PNG

Best Regards,

Community Support Team _ Zhongys

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

so the condition has to be entered after getting the content?

So if I want to save the content to onedrive, i need to Get file content (OneDrive for Business) before the condition? 

I never know when to use actions from which app group..

 

Thanks,

Hi @Anonymous ,

The 'Get file content' need to be added before the 'Condition'.

Here the file content is from sharePoint library, so you need use the action 'Get file content (SharePoint)'.

Best Regards,

Community Support Team _ Zhongys

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

Anonymous
Not applicable

So If I want to save that file to my PC ?

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Users online (2,801)