cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
NewNW
Advocate II
Advocate II

How to concat SharePoint URL

Hi,

 

I m trying to comma separate each folder and library for documents based on the URL. I want to remove the Tenancy URL and the name of the site. 

eg- file path is https:\\xxx.sharepoint.com\sites\test7777\Document Library 1\Folder1\Folder2\documnet1.docx

 

I want the variable assigned as follows

 

Variable Path  =Document Library 1, Folder1, Folder 2

 

 

Can someone please help me with this? 

Thanks. 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Expiscornovus
Super User
Super User

Hi @NewNW,

 

You could use an expression with the slice, lastIndexOf & nthIndexOf functions. You want to start the slicing at the 5th instance of the / characters (I assume the backward slashes are a typo 😉) and end at the last instance of the forward slash.


Below is an example of this approach:

 

slice(variables('FilePath'), nthIndexOf(variables('FilePath'), '/', 5),lastIndexOf(variables('FilePath'),'/'))

 

 

slice_filepath.png

 

The result will look something like this:

 

slice_filepath_result.png



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #PowerVirtualAgents content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


View solution in original post

3 REPLIES 3
Expiscornovus
Super User
Super User

Hi @NewNW,

 

You could use an expression with the slice, lastIndexOf & nthIndexOf functions. You want to start the slicing at the 5th instance of the / characters (I assume the backward slashes are a typo 😉) and end at the last instance of the forward slash.


Below is an example of this approach:

 

slice(variables('FilePath'), nthIndexOf(variables('FilePath'), '/', 5),lastIndexOf(variables('FilePath'),'/'))

 

 

slice_filepath.png

 

The result will look something like this:

 

slice_filepath_result.png



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #PowerVirtualAgents content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


NewNW
Advocate II
Advocate II

Hi @Expiscornovus 

Thank you very much, but this will work if the folder depth is 2, What will happen if there is an additional folder called Folder3? 

Expiscornovus
Super User
Super User

Hi @NewNW,

 

The number of sub folders should not matter since we slice it at the last /. This should always be the last slash before the filename.

 

But obviously test the solution to double check 😉



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #PowerVirtualAgents content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


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 (1,699)