How to use Flow for metadata management in SharePoint document libraries

Frequent Contributor

Hi, I'm pretty new to Flow but due to the peculiar lack of built in support for automated metadata management in SharePoint I'm trying to setup a Flow that will help me achieve some basic stuff.

 

However, I constantly run into issues.

1. How can I parse the folder names if a user uploads a set of folders? (i.e. I can use dynamic content "Folder path" and it will give me something like "Shared documents/foldername1/foldername2/" how can I in this case pick out "foldername1" and add that as the value of a metadata column for that file?

 

2. If I use the "update file properties" and add metadata to one of the columns then all other columns will be affected too (in effect , any existing metadata will be deleted if I don't "update" them with their existing value) - how can I update only those columns that I want to update and ignore those who have values already?

 

I'm sure there are lots of much better ways of using Flow to manage metadata for libraries, I'd really appreciate any tips or ideas

 

1 Reply
Managed to resolve my first question myself by looking at other examples and some trial & error. It's pretty simple once you know how:
split(body('Update_file_properties')?['{Path}'],'/')?[1] did the trick of returning the folder name (directly in the root of the library) of any document uploaded