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

How to get my child folder name?

Hi All, 

I try to upload child folder to my SharePoint document library and I would like to get the child folder name and send an email together with the child folder name. Unfortunately I use "Folder Path" in flows, but it only give me the main folder name, I cannot get the child folder name.

JacksonTeo_1-1625556089276.png

 

JacksonTeo_0-1625556011280.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
v-bofeng-msft
Community Support
Community Support

Hi @JacksonTeo :

If your file is in a subfolder, then "Folder Path" contains the name of the subfolder. for example:

If the Full Path is

picc/SubFolder1/Document.docx

Then the folder Path should be

picc/SubFolder1/

If in this case you only want to get "SubFolder1",you could try this Expression:

split(triggerOutputs()?['body/{Path}'],'/')[sub(length(split(triggerOutputs()?['body/{Path}'],'/')),2)]

vbofengmsft_0-1625562698630.png

The Result

vbofengmsft_1-1625562730176.png

Best Regards,

Bof

 

View solution in original post

4 REPLIES 4
v-bofeng-msft
Community Support
Community Support

Hi @JacksonTeo :

If your file is in a subfolder, then "Folder Path" contains the name of the subfolder. for example:

If the Full Path is

picc/SubFolder1/Document.docx

Then the folder Path should be

picc/SubFolder1/

If in this case you only want to get "SubFolder1",you could try this Expression:

split(triggerOutputs()?['body/{Path}'],'/')[sub(length(split(triggerOutputs()?['body/{Path}'],'/')),2)]

vbofengmsft_0-1625562698630.png

The Result

vbofengmsft_1-1625562730176.png

Best Regards,

Bof

 

Hi @v-bofeng-msft ,

Thanks for your reply. I tried your method, unfortunately I still get the main folder name just without a "/" at the end.

I have do some test, if I upload entire subfolder(with files) in SharePoint document library, I will keep getting the Main folder name. But If I just upload a file into my sub folder, I will get the correct folder path (main folder/sub folder).

so my question is, is it unable to get sub folder name if I upload the entire sub folder from the SharePoint Document Library?

JacksonTeo_0-1625638312155.png

 

 

When I upload entire folder, i will only get this

JacksonTeo_1-1625638467750.png

 

 

Thanks for your support!

Regards,

Jackson

Hi @JacksonTeo :

Yes that is.

Best Regards,

Bof

JacksonTeo
Frequent Visitor

Hi @v-bofeng-msft ,

Finally I figure it out. Thanks for your help. I just change the compose Expression to:

split(triggerOutputs()?['body/{FullPath}'],'/')[sub(length(split(triggerOutputs()?['body/{FullPath}'],'/')),1)]
and it works!!
Appreciate your help!
 
Regards,
Jackson

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Users online (3,850)