How to get SharePoint folder names?

  • 16 April 2018
  • 2 replies
  • 59 views

Badge +4

Hello community,

we have a SharePoint library with a folder structure 4 levels deep.

I need to get all folder names of a document in separate variables.

Once I have the folder names the workflow adds a link to the document in a second list along with the modified date of the document. This list has a view that can be grouped by the folder names and is sorted by modified date in descending order. It should give our users quick access to the latest modified files in the document library.

The complete URL looks like:

<WebURL>/libraryname/folder1/folder1-2/folder1-2-1/folder1-2-1-1/filename.ext

When I use the following RegEx

Pattern:    [^/]+$

Operation: Replace Text

Replacement Text:

Input Text: fn-Replace({Common:ItemUrl},{Common:WebUrl},"")

the remaining string is:

/libraryname/folder1/folder1-2/folder1-2-1/folder1-2-1-1/

Now I need the folders in variables like:

Folder1 = folder1

Folder2 = folder1-2

Folder3 = folder1-2-1

Folder4 = folder1-2-1-1

So far I was not able to find the RegEx patterns to achieve this.

I would be very happy if someone here already solved this problem or has a good knowledge about RegEx to solve it.

Thank you very much in advance.

Thomas


2 replies

Userlevel 5
Badge +14

have  a look on this

https://community.nintex.com/message/75534-re-workflow-to-check-calender-for-items-in-future-to-generate-folder-tasks?co… 

Badge +4

Hello Marian,

Thank you for your answer. This looks like it would exactly solve my problem.

I am going to test this and mark it as correct answer then.

Best Regards

Thomas

Reply