cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
mdemarici
Frequent Visitor

Move files from my companies SharePoint Site to our clients site based on metadata tags.

My objective is to be able to upload a document in our document library, tag it with metadata including the client's name, doc type, etc. and have it automatically move to our client's site based on the tags. I think this can be done with a flow, but I am concerned that our folder structure will get in the way. 

 

Currently, our Doc Library and Clients Site's Doc Library is set up with a multi-level folder structure. There are about 400 folders in our library and about 100 in our clients sites. Would it be better to have a flat structure in order to perform this automation?

 

A visual of my companies and our client's folder structure

 

Folder 1 - Microsoft

Folder 2 - Apple

Folder 3 - AMD

Folder 4 - XYZ

 

inside of each of these folders are subfolders...

 

Folder 1 - Legal

Folder 2 - Financial

Folder 3 - Reports

Folder 4 - Transactions

 

Inside each of these folders are folders that correspond with the year. 

 

This would be the ideal scenario if everything worked correctly...

 

I (Marcus) receive documents for my clients, Daniel and Chris from a company that we both deal with, let's call it Microsoft. I download the files and navigate to the Microsoft Company folder then to the financial documents subfolder then to then 2020 folder. I drag the files into the window to upload them, hit quick edit, and tag each file with Metadata (clients name, doc type, etc). Once I am done tagging, an automated flow moves Chris's file to his SharePoint site and Mike's to his. Chris and Mike can only see documents tagged with their names, and they can also see that the document is in their Microsoft folder in the Financial Documents subfolder. 

 

Is this possible with multi-level folders? It is to my understanding I would have to map the target folder to the source folder, doing this would take a lot of time considering there are about 5 subfolders in each Company folder. Would it be better if I was working with a flat structure with only metadata columns?

 

My company and my clients are used to using the folders, I would like to figure out a way where I can keep the folder structure, but I'm unsure whether I have to map each folder or if there is a better way to handle this.  I can potentially convince management and clients to switch to a flat structure if I can make it have a similar look and feel, navigation, etc. 

 

Thank you for reading!!

1 ACCEPTED SOLUTION

Accepted Solutions

Hello @mdemarici 

Thank you for the information. Let me try and make it clearer.

I use a string variable to build the folder path, so after your trigger, initialize a variable to hold the folder path - initial value usually is the document library. See my screenshots below. I have included only the parts where I ensure that the folder path in which the document is to be moved, exists before the move file action.

MoveFileToTargetACustomer.png 

First part is to get the customer value from the file properties and add it to my folder path variable (TargetPath).

I then check to see if the folder exists already and if it does, I just continue, but if it does not exist then I create it.

 

The same I do with the file property Service ... add to variable, check that folder exists, create if not.

MoveFileToTargetBService.png

Do the same for all your properties/folder levels 😉

At last just use a Move file action to move your file from its path to the folder path variable.

Kind regards, John

View solution in original post

10 REPLIES 10
JohnAageAnderse
Memorable Member
Memorable Member

Hello @mdemarici 

I can't decide for you what you and your partners will do, but I can give a little information on how we are using Flow to move our documents around and the reason for it. Please note that we mostly are using Classic SharePoint still 🙂

 

In the beginning we had the Shared Documents library as a flat structure, no folders at all. At the same time we have a lot of different customers for which we need to have specific documentation. We were forced to include the customer name in the documents filename, so as not to have a conflict on naming.

 

We had already added several properties to the documents library - customer, service, tags. Also several content types were defined. As our colleagues works in teams and each teams provides support for one or more services, the above allowed us to create team pages and team customer pages which presented their customers and the documents related to customers and services - we introduced a minimal click solution for our teams - 1st click on customer, 2nd click on the document.

 

After some time, to avoid the filename conflict, we decided to introduce folders in the document library. We went with 3 levels, customer, service, content type. The introduction of folders had no impact on the presention in the team customer pages.

 

A flow was setup to automatically move a document into the correct folder based on the properties. By now having documents inside this folder structure, our colleagues can now name their documents without a customer name.

 

Hope the above gives you some ideas. Kind regards, John

Hi John, 

 

Thank you for taking the time to reply. I was able to get a flow going that moves the documents to a folder based on tags, any tips on moving the files to sub folders?

 

It sounds like our situations are similar. Us and our clients receive documents from a fairly large number of other companies. This semi large number of company names would be the names of the sub-folders. Do you have any insight as to how to write the flow to go to sub-folders? Do I have to write a condition for each company, or is there a way to do it with fewer conditions?

 

right now my flow is like this 

 

get created doc --> pull metadata --> if client abc, move to client abc folder 

 

What would be the best way to do this..

 

get created doc --> pull metadata --> if client abc, move to client abc folder --> move to company name folder within client abc folder

 

Thanks again for the help! @JohnAageAnderse 

Hello @mdemarici 

We use a known folder structure, so even when a new customer comes in or they start to receive a service, the flow will automatically create the needed folder structure.

The flow starts by building the folder path - first as just the customer name, checks that the folder exists, creates it if not - then takes the next level from the properties - service, adds it to the folder path, checks that the folder exists, creates it if not - and so on.

A document can end up in either the customer folder, the service folder or in the content type folder. The reason some documents ends up in the customer folder, is that they are not related to a service.

My best suggestion is for you to discuss your needed structure with your colleagues and then implement a solution for it.

Kind regards, John

Thank you, John. That description was very helpful to me!

Hi @JohnAageAnderse I'm trying to mimic your description, but I am unsuccessful. would you mind sending me a screenshot of how the flow starts by building the path?

 

Do you use the "create a new folder"  process?

Hello @mdemarici 

Thank you for the information. Let me try and make it clearer.

I use a string variable to build the folder path, so after your trigger, initialize a variable to hold the folder path - initial value usually is the document library. See my screenshots below. I have included only the parts where I ensure that the folder path in which the document is to be moved, exists before the move file action.

MoveFileToTargetACustomer.png 

First part is to get the customer value from the file properties and add it to my folder path variable (TargetPath).

I then check to see if the folder exists already and if it does, I just continue, but if it does not exist then I create it.

 

The same I do with the file property Service ... add to variable, check that folder exists, create if not.

MoveFileToTargetBService.png

Do the same for all your properties/folder levels 😉

At last just use a Move file action to move your file from its path to the folder path variable.

Kind regards, John

Hi @JohnAageAnderse 

Thank you for your continued support in this.

 

One quick question on the creation of the folder using the folder path string variable.

 

I'm getting an error that the folder name contains characters that are not supported when I use the folder path target variable in the create new folder step. Pic below. is there another way to use that variable in the create folder step so that it works?

 

 I also noticed in your pictures earlier, you used the get folder metadata using path step, I tried that and was also getting some errors as the target path was "not found" and for some reason, it didn't move onto the next step even when the "run after" said to move on whether it succeeds or fails

 

to understand this correctly, the target path is where the document needs to be added, the destination aka the customer folder, correct? if so, if it's not created yet, is the "get Folder metadata from the target path" step going to automatically fail, and that's why you have the "run after" step?

 

Thank you so much again, your last reply was a breakthrough for me and I feel like I am very close to solving this now. 

 

 

Hello @mdemarici 

Good to see that you are moving forward 🙂

 

About the folder path - yes, it must not contains any unsupported characters - you will have to look up what they are. I do change one character due to us having danish customers also and their name may have a slash "/" in it (a company type "A/S"), so we decided to just remove it.

 

The reason we are checking for the existence of a folder is that the customer may be new, or the service may be newly signed up to, so the folder may not yet exist.

 

By the way, in your condition it says "TargetPath contains TargetPath"?? It should be "<get folder meta data using path>Id is not equal to null (expression)" - testing if the action returned anything (old solution before Configure run after became available).

Kind regards, John

Thanks! @JohnAageAnderse 

 

Thanks for the clarification, so I have to change the characters inside the variable itself, the fact that im putting the variable in the folder path box isn't the issue? 

 

The if TargetPath contains TargetPath is actually TargetPath contains TargetPath2. I ended up making another variable that didn't have the customer name as a folder at the end because I was not sure why I was getting the error on the "Get folder Metadata using path" Step. it was saying it didn't exist. 

Was I running that step correctly? I was using the target path as the folder for the step. 

 

Thanks!

Hello @mdemarici 

The step Get folder metadata using path may succeed or may fail - the condition after checks to see if it was a success (Yes branch) or a failure (No branch).

Today with the features available, you actually don't need the condition, but can use a scope to hold the No branch steps and then configure the Scope to run only after a failure in the Get folder metadata using path step. (A future task for me to update our flow).

Kind regards, John

Helpful resources

Announcements

Power Platform Connections - Episode 7 | March 30, 2023

Episode Seven of Power Platform Connections sees David Warner and Hugo Bernier talk to Microsoft MVP Dian Taylor, alongside the latest news, product reviews, and community blogs.     Use the hashtag #PowerPlatformConnects on social media for a chance to have your work featured on the show!      Show schedule in this episode:    0:00 Cold Open 00:30 Show Intro 01:02 Dian Taylor Interview 18:03 Blogs & Articles 26:55 Outro & Bloopers    Check out the blogs and articles featured in this week’s episode:    https://francomusso.com/create-a-drag-and-drop-experience-to-upload-case-attachments @crmbizcoach https://www.youtube.com/watch?v=G3522H834Ro​/  @pranavkhuranauk https://github.com/pnp/powerapps-designtoolkit/tree/main/materialdesign%20components @MMe2K​ https://2die4it.com/2023/03/27/populate-a-dynamic-microsoft-word-template-in-power-automate-flow/ @StefanS365 https://d365goddess.com/viva-sales-administrator-settings/ @D365Goddess https://marketplace.visualstudio.com/items?itemName=megel.mme2k-powerapps-helper#Visualize_Dataverse_Environments @MMe2K    Action requested:  Feel free to provide feedback on how we can make our community more inclusive and diverse.    This episode premiered live on our YouTube at 12pm PST on Thursday 30th March 2023.    Video series available at Power Platform Community YouTube channel.    Upcoming events:  Business Applications Launch – April 4th – Free and Virtual! M365 Conference - May 1-5th - Las Vegas Power Apps Developers Summit – May 19-20th - London European Power Platform conference – Jun. 20-22nd - Dublin Microsoft Power Platform Conference – Oct. 3-5th - Las Vegas    Join our Communities:  Power Apps Community Power Automate Community Power Virtual Agents Community Power Pages Community    If you’d like to hear from a specific community member in an upcoming recording and/or have specific questions for the Power Platform Connections team, please let us know. We will do our best to address all your requests or questions.       

Announcing | Super Users - 2023 Season 1

Super Users – 2023 Season 1    We are excited to kick off the Power Users Super User Program for 2023 - Season 1.  The Power Platform Super Users have done an amazing job in keeping the Power Platform communities helpful, accurate and responsive. We would like to send these amazing folks a big THANK YOU for their efforts.      Super User Season 1 | Contributions July 1, 2022 – December 31, 2022  Super User Season 2 | Contributions January 1, 2023 – June 30, 2023    Curious what a Super User is? Super Users are especially active community members who are eager to help others with their community questions. There are 2 Super User seasons in a year, and we monitor the community for new potential Super Users at the end of each season. Super Users are recognized in the community with both a rank name and icon next to their username, and a seasonal badge on their profile.  Power Apps  Power Automate  Power Virtual Agents  Power Pages  Pstork1*  Pstork1*  Pstork1*  OliverRodrigues  BCBuizer  Expiscornovus*  Expiscornovus*  ragavanrajan  AhmedSalih  grantjenkins  renatoromao    Mira_Ghaly*  Mira_Ghaly*      Sundeep_Malik*  Sundeep_Malik*      SudeepGhatakNZ*  SudeepGhatakNZ*      StretchFredrik*  StretchFredrik*      365-Assist*  365-Assist*      cha_cha  ekarim2020      timl  Hardesh15      iAm_ManCat  annajhaveri      SebS  Rhiassuring      LaurensM  abm      TheRobRush  Ankesh_49      WiZey  lbendlin      Nogueira1306  Kaif_Siddique      victorcp  RobElliott      dpoggemann  srduval      SBax  CFernandes      Roverandom  schwibach      Akser  CraigStewart      PowerRanger  MichaelAnnis      subsguts  David_MA      EricRegnier  edgonzales      zmansuri  GeorgiosG      ChrisPiasecki  ryule      AmDev  fchopo      phipps0218  tom_riha      theapurva  takolota     Akash17  momlo     BCLS776  Shuvam-rpa     rampprakash  ScottShearer     Rusk  ChristianAbata     cchannon  Koen5     a33ik  Heartholme     AaronKnox  okeks      Matren   David_MA     Alex_10        Jeff_Thorpe        poweractivate        Ramole        DianaBirkelbach        DavidZoon        AJ_Z        PriyankaGeethik        BrianS        StalinPonnusamy        HamidBee        CNT        Anonymous_Hippo        Anchov        KeithAtherton        alaabitar        Tolu_Victor        KRider        sperry1625        IPC_ahaas      zuurg    rubin_boer   cwebb365   Dorrinda   G1124   Gabibalaban   Manan-Malhotra   jcfDaniel   WarrenBelz   Waegemma   drrickryp   GuidoPreite    If an * is at the end of a user's name this means they are a Multi Super User, in more than one community. Please note this is not the final list, as we are pending a few acceptances.  Once they are received the list will be updated. 

Register now for the Business Applications Launch Event | Tuesday, April 4, 2023

Join us for an in-depth look into the latest updates across Microsoft Dynamics 365 and Microsoft Power Platform that are helping businesses overcome their biggest challenges today.   Find out about new features, capabilities, and best practices for connecting data to deliver exceptional customer experiences, collaborating, and creating using AI-powered capabilities, driving productivity with automation—and building towards future growth with today’s leading technology.   Microsoft leaders and experts will guide you through the full 2023 release wave 1 and how these advancements will help you: Expand visibility, reduce time, and enhance creativity in your departments and teams with unified, AI-powered capabilities.Empower your employees to focus on revenue-generating tasks while automating repetitive tasks.Connect people, data, and processes across your organization with modern collaboration tools.Innovate without limits using the latest in low-code development, including new GPT-powered capabilities.    Click Here to Register Today!    

Check out the new Power Platform Communities Front Door Experience!

We are excited to share the ‘Power Platform Communities Front Door’ experience with you!   Front Door brings together content from all the Power Platform communities into a single place for our community members, customers and low-code, no-code enthusiasts to learn, share and engage with peers, advocates, community program managers and our product team members. There are a host of features and new capabilities now available on Power Platform Communities Front Door to make content more discoverable for all power product community users which includes ForumsUser GroupsEventsCommunity highlightsCommunity by numbersLinks to all communities Users can see top discussions from across all the Power Platform communities and easily navigate to the latest or trending posts for further interaction. Additionally, they can filter to individual products as well.   Users can filter and browse the user group events from all power platform products with feature parity to existing community user group experience and added filtering capabilities.     Users can now explore user groups on the Power Platform Front Door landing page with capability to view all products in Power Platform.      Explore Power Platform Communities Front Door today. Visit Power Platform Community Front door to easily navigate to the different product communities, view a roll up of user groups, events and forums.

Microsoft Power Platform Conference | Registration Open | Oct. 3-5 2023

We are so excited to see you for the Microsoft Power Platform Conference in Las Vegas October 3-5 2023! But first, let's take a look back at some fun moments and the best community in tech from MPPC 2022 in Orlando, Florida.   Featuring guest speakers such as Charles Lamanna, Heather Cook, Julie Strauss, Nirav Shah, Ryan Cunningham, Sangya Singh, Stephen Siciliano, Hugo Bernier and many more.   Register today: https://www.powerplatformconf.com/   

Users online (3,446)