Skip to main content

How do we fetch the folder name via a workflow that a file is sitting in within a sharepoint online library?

Hi @brandiwoodson

 

this can be accomplished, by the query list action, there is a variable in the object which called Content Type ID, if you query a list with a folder in it, you will see that a folder has a different context typ id as a file.

This Content typ ID can be filtered, so you can build e.g a condition to filter all folders out of a list.

 

 

 

Another idea is (but no recommend), if you query a list and the name of the item without any filetyp that is the foldername.

 

regards

 

Sven

 


Hi @brandiwoodson

 

this can be accomplished, by the query list action, there is a variable in the object which called Content Type ID, if you query a list with a folder in it, you will see that a folder has a different context typ id as a file.

This Content typ ID can be filtered, so you can build e.g a condition to filter all folders out of a list.

 

 

 

Another idea is (but no recommend), if you query a list and the name of the item without any filetyp that is the foldername.

 

regards

 

Sven

 

Ok but how does this help me identify the folder a file is sitting in? There are multiple folders in this library (for projects).....i know how to use content type on the item that is triggering a workflow but this info is not available on the files for correlation back to the folder


Hi @brandiwoodson 

Not sure what your trigger is for the workflow. But here is a workflow that I have based on SharePoint item created as the trigger. The workflow create subfolders when a document set is created in a library.

I need to know the path of the document set for the create folder action.

I have a workflow variable with a null value.

 

Then I have a modify string action which uses the start event ItemURL property of the document set,

then find the Start Event, Site Context, List URL and replace that substring with the empty string variable. This leave me with the Document set folder path.

 

In the create folder action, I use the path to create a new folder in.

 

This might not be exactly what you are after but hopefully leads you down the right path, so to speak. 😀

Possibly if you extract out the list URL and the item name from the item URL you are left with the folder.


I don't know anything about document sets. I'll have to learn that and try that process.

We use a list to trigger workflow. It's created when a new file is created in a library so we can track what we need on the file. I have the editURL and ID from the library for the file stored in the SPO list for the correlation on which list item supports what file. 

We can't use metadata to tra k data on a file until Nintex finds a way to prevent workflow failures when an item is opened by a user. 


@brandiwoodson 

document sets are jsut a special type of folder that support additional metadata also allows that metadata to be inherited on to the metadata against the documents within that document set. It’s a cool feature for advanced document management.

 

In your workflow, if use a ‘retirve an item’ action based on t\he ID of the file that you store in the list, that output of that action should have the URLs variables that you need similar to what I have from my start event vaiable as I detailed above.


@brandiwoodson

document sets are jsut a special type of folder that support additional metadata also allows that metadata to be inherited on to the metadata against the documents within that document set. It’s a cool feature for advanced document management.

 

In your workflow, if use a ‘retirve an item’ action based on t\he ID of the file that you store in the list, that output of that action should have the URLs variables that you need similar to what I have from my start event vaiable as I detailed above.

First off, thank you for the detailed responses. Greatly appreciated.

Ok, not really sure if I am even doing it right but I created a document set to a test library then triggered a component workflow to grab details from a file real quick. The properties I’m looking for - folder name the file belongs to - still doesn’t exist in document set unless I have to build this somehow. 

If I have to manipulate the data either way based on item or list URL then I will just use a regular document library folder vs overly complicating our process with “document sets”. 

The only way to capture the path or item URL is on a start event trigger from the library. Wondering why Nintex doesn’t provide site context info on a file when using retrieve an item or query a list.

So, I ended up just doing the following since I’m already capturing the item URL to build a “editable” version link of the document for the list since the list is the primary source users will be uses for document tracking per file.

  • Text variable titled “Project”
  • Set Project to List URL
  • Reg expression to replace site URL on Project

The only thing I’m stuck on now is removing the %20 placeholders with a space since SharePoint adds these, or at least for us it does. At a loss at the moment but will try again tomorrow. 

Unless you have an easier approach? See attached picture. 

 


Well crap, just realized that is the library path, not the subfolder. I’m so exhausted. I will do this tomorrow. lol Still need to know how to remove the %20 from the path with a space. :/


Reply