cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
eden
Helper I
Helper I

Triming : File Properties in sharepoint flow ?

Hello , 

I am running a flow against a selected item and after getting file properties  as below ,will send an approval request.

 

Sp File prope.JPG

 

Above my full path is like this  < /LibraryName/Foldername>  , i want to remove the first 16 characters and only send /Foldername in the approval request..

 

Any help would be valuable.. thanks you 

1 ACCEPTED SOLUTION

Accepted Solutions

Click into the field where you want the data to go and click on the expression editor:

Expression.PNG

Paste it in there. I might be easier for you at this stage to put it in a compose step before the action you want to use it in so you can examine the output.

View solution in original post

10 REPLIES 10
Paulie78
Super User
Super User

Use this expression:

 

substring(outputs('Compose'), lastIndexOf(outputs('Compose'), '/'))

 

replace outputs('Compose'with your "Folder Path" dynamic content.

 

Please...

If I answered your question Accept it as a solution ✔️ 

If I helped you out, please give me some Kudos 👍

Thanks 😙

Error.JPG

 

 

We are getting the above error 

Try this, it is hard to give you the exact expression unless you post the exact output of your Get File Properties action from the run history:

substring(outputs('Get_file_properties')?['body/{Path}'], IndexOf(outputs('Get_file_properties')?['body/{Path}'], '/'))

or if you just want to get rid of the first X characters as you said originally you can just do:

substring(outputs('Get_file_properties')?['body/{Path}'], 12)

This will get everything after the 12th character, change the number to suit your results. 

I will  attach the get file properites 

 

Fodl.JPG

Did you try the expressions I gave you?

Yes , 

Its working but not perfect  as its only returning the last part .. 

 

I only want to trim the first Part of the folder path 

 

example :  sales_library/Contract/Tender

 

Here i need  to  retrun :  </contract/Tender >

 

example 2 : Sales_library/Purchase/Delivery

Expected :     /Purchase/Delivery

 

 

Then this should be what you need:

substring(outputs('Get_file_properties')?['body/{Path}'], IndexOf(outputs('Get_file_properties')?['body/{Path}'], '/'))

Everything after the first / symbol 

How to declare this expression, ?

Click into the field where you want the data to go and click on the expression editor:

Expression.PNG

Paste it in there. I might be easier for you at this stage to put it in a compose step before the action you want to use it in so you can examine the output.

This is filtering the path rightly but is it possible to add the file name also with the filter

 

example : <sale_li/Customer/Tender/docsksjsu02.pdf>

 

 

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.

Users online (5,231)