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

Assign specific metadata to a file, dependent on subfolder name

Hello All,

I would like to update my file properties- value under custom column, which depends on the name of the subfolder where it was created. So, imagine "Root Folder", and Subfolder "X". If a file was created or modified in Subfolder "X", update file properties- value under particular column will be "Y". If the subfolder is named "Z" then value in the column should be "A", etc. It seems simple, but I don't know how to get the subfolder address not, the root folder. Could someone help please? 

2 ACCEPTED SOLUTIONS

Accepted Solutions
DamoBird365
Microsoft
Microsoft

Morning @Anonymous 

 

You can get the full folder path for an item using either the trigger or get file properties like so:

 

DamoBird365_0-1614590822951.png

 

This returns:

Shared Documents/General/Test1/

 

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


P.S. take a look at my new blog here

View solution in original post

DamoBird365
Microsoft
Microsoft

Hi @Anonymous 

 

Using a few compose actions you could get the last folder of a path like so:

1. drop the last char of the file path string (/)
substring(outputs('Get_file_properties')?['body/{Path}'],0,add(length(outputs('Get_file_properties')?['body/{Path}']),-1))
 
2. get the last occurence of the / in new substring from above compose and add 1
add(lastIndexOf(outputs('SubString'),'/'),1)
 
3. output string after last / in first compose string
substring(outputs('SubString'),outputs('LastIndex'))
 
123.png

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


P.S. take a look at my new blog here

View solution in original post

5 REPLIES 5
DamoBird365
Microsoft
Microsoft

Morning @Anonymous 

 

You can get the full folder path for an item using either the trigger or get file properties like so:

 

DamoBird365_0-1614590822951.png

 

This returns:

Shared Documents/General/Test1/

 

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


P.S. take a look at my new blog here

Anonymous
Not applicable

@DamoBird365 Hello, 

Thank you.

and how to refer to the last folder of the path to switch on its name?

Veingro_0-1614591343339.png

So the last subfolder the file is in, is - 'Change Requests' and I would like to create different actions dependent on that last value. Each time, document has a different full path, but the subfolders are the same so I can create a condition, but not sure how to write it down correctly?

Anonymous
Not applicable

@DamoBird365 Oh, I think I can do that simply by Condition, whether Folder Path contains certain value, right? 🙂

Anonymous
Not applicable

@DamoBird365 Yope, it's working. Thanks for help 🙂

DamoBird365
Microsoft
Microsoft

Hi @Anonymous 

 

Using a few compose actions you could get the last folder of a path like so:

1. drop the last char of the file path string (/)
substring(outputs('Get_file_properties')?['body/{Path}'],0,add(length(outputs('Get_file_properties')?['body/{Path}']),-1))
 
2. get the last occurence of the / in new substring from above compose and add 1
add(lastIndexOf(outputs('SubString'),'/'),1)
 
3. output string after last / in first compose string
substring(outputs('SubString'),outputs('LastIndex'))
 
123.png

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


P.S. take a look at my new blog here

Helpful resources

Announcements
 WHAT’S NEXT AT MICROSOFT IGNITE 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Register for a Free Workshop.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Users online (2,037)