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

Move(or copy) folder from Sharepoint library to another on same site when all files have been approved

Hello, 

 

I have 2 document libraries one where users are putting folders with documents to review and another where those folders will be moved to. On the condition that all documents inside of the folder are set to "yes" in the yes/no column then that folder will get moved to the other document library. These folders will always be different names and the documents inside will also always be different. I have researched that metadata can not be assigned on the folder level so my thought process is with that in mind. The most simple way is if folder metadata was possible is set it to yes and then get moved. 

 

I have created a flow successfully that copies the files from one library to the other but not the whole folder. 

 

My question is if this is possible and if so if someone can give me a rundown or outline on how that would like in Flow. 

 

Thank you for any help. 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User II
Super User II

Re: Move(or copy) folder from Sharepoint library to another on same site when all files have been approved

Hello @Anonymous 

 

First, there is an action to move a folder in SharePoint, just look it up.

 

Second, after a review, where the document property is set to Yes, you can perform a check for all the documents inside the same folder, and if all are set to Yes, then move the folder.

 

How to do that? With a flow triggered by When a file is created or modified, you check for the Yes value.

If Yes is set, then identify the folder in which the document is - use the Folder path property.

With the folder known, use a Get files action and fill the field Limit entries to Folder with the identified folder.

In the Get files action, enter the Filter query as "<your yes no property internal name> eq 0" - so it looks like (my  property is named PassedReview):

PassedReview eq 0

Note that a Yes/No column compares with 1/0 in the Filter query field!

 

If no files are retrieved, then all of them has a Yes value and you can move the folder 🙂

Hope this help you on the way, kind regards, John

 

View solution in original post

8 REPLIES 8
Highlighted
Super User II
Super User II

Re: Move(or copy) folder from Sharepoint library to another on same site when all files have been approved

Hello @Anonymous 

 

First, there is an action to move a folder in SharePoint, just look it up.

 

Second, after a review, where the document property is set to Yes, you can perform a check for all the documents inside the same folder, and if all are set to Yes, then move the folder.

 

How to do that? With a flow triggered by When a file is created or modified, you check for the Yes value.

If Yes is set, then identify the folder in which the document is - use the Folder path property.

With the folder known, use a Get files action and fill the field Limit entries to Folder with the identified folder.

In the Get files action, enter the Filter query as "<your yes no property internal name> eq 0" - so it looks like (my  property is named PassedReview):

PassedReview eq 0

Note that a Yes/No column compares with 1/0 in the Filter query field!

 

If no files are retrieved, then all of them has a Yes value and you can move the folder 🙂

Hope this help you on the way, kind regards, John

 

View solution in original post

Highlighted
Anonymous
Not applicable

Re: Move(or copy) folder from Sharepoint library to another on same site when all files have been approved

That makes a lot of sense. Thank you for the thorough response and I will be giving this a try today!

Highlighted
Anonymous
Not applicable

Re: Move(or copy) folder from Sharepoint library to another on same site when all files have been approved

@JohnAageAnderse  At this step: "If Yes is set, then identify the folder in which the document is - use the Folder path property." I am having some issues. Which SharePoint Action would I choose for this? Here is how I currently have this set up:QuoteToSales-Flow.png

 

 
 
Highlighted
Super User II
Super User II

Re: Move(or copy) folder from Sharepoint library to another on same site when all files have been approved

Hello @Anonymous 

 

In your action "Get files ..." add the Folder path value from the trigger "When a file is ...".

In filter query field, use "Completed eq 0" - do not enter the field from the trigger! You can hover the mouse over the Completed? property to see what the name is.

 

Remove the action "Move folder" so that you don't accidentally starts to move the folder before you have checked that all files are completed 🙂

 

After the "Get files ..." action, you need a condition that uses an expression "length(body('Get_files_(properties_only)')?['value'])" and comparision "is equal to" the value 0.

If yes, move the folder (meaning your move folder action goes here), else if no, do nothing.

Kind regards, John

Highlighted
Anonymous
Not applicable

Re: Move(or copy) folder from Sharepoint library to another on same site when all files have been approved

Hey @JohnAageAnderse ,

 

So I have been trying to work through this for a few days and I am still having issues. I am not having any errors any more but the flow is just not finishing. I have added my screen caps below so maybe you can shed some light on what I might be doing wrong when you get a chance. Thank you. 

move_folder_1move_folder_1

 

 

move_folder_2move_folder_2

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

move_folder_3move_folder_3

 

 

 

 

 

 

Highlighted
Super User II
Super User II

Re: Move(or copy) folder from Sharepoint library to another on same site when all files have been approved

Hello @Anonymous 

Good that you are trying 🙂 Let me try and shed some light on the actions you need.

 

1) Trigger:

Use When a file is created or modified (properties only) - not When a file is created or modified in a folder.

This trigger will react to any file creation/modification in the document library, no matter in which folder.

 

2) Condition:

Add a Condition to check that this file has the property Completed is equal to true

If the file does not have Completed = true, then no need to go further.

 

3) Terminate in the If No branch of 2) Condition

Add a Terminate action, set it to Succeeded, in the If No branch to stop further processing.

 

4) After the 2) Condition

Use the Get files (properties only) action with a filter query as Completed eq 0 and limit entries to folder as property Folder path from the trigger action.

This will get any other files in the same folder which has the property Completed equal to No (0).

 

5) Condition

Add a Condition to check that the expression length(body('Get_files_(properties_only)')?['value']) is equal to 0

This will tell whether or not to continue - if equal to 0 then all files in the folder path are completed and the folder can be moved.

 

6) Terminate in the If No branch of 5) Condition

Add a Terminate action, set it to Succeeded, in the If No branch to stop further processing.

 

7) Move folder after the 5) Condition

Use a Move folder action to move the Folder path to your new location

 

You are done 🙂 Hope this helps a little, kind regards, John

Highlighted
Anonymous
Not applicable

Re: Move(or copy) folder from Sharepoint library to another on same site when all files have been approved

Hey @JohnAageAnderse ,

 

I feel I am pretty close. The last reply you gave helped me quite a bit so thank you for being so thorough. I feel I have learned quite a bit about Flow and how it works from this project. 

 

I have one last question. It looks like everything is working, but it is still not moving the folder. I can't look at the output either because "move folder" is grayed out. Do you know why this might be happening?move_folder_graymove_folder_gray

 

I have added all the necessary dynamic values that I thought I needed to the "move folder" action. 

move_folder_inputmove_folder_input

 

Thanks for you help again.

Highlighted
Super User II
Super User II

Re: Move(or copy) folder from Sharepoint library to another on same site when all files have been approved

Hello @Anonymous 

Good that you got further 🙂

I see that your Move folder action ended up in an Apply to each loop, which it shouldn't! To fix that, make sure that your Folder path is the one from the trigger action, not from the Get files (...) action.

 

The reason it is greyed out inside the Apply to each loop, is because the loop hasn't finished yet. That is normal, but as I stated above, there should be no loop there.

Kind regards, John

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Users online (5,279)