Skip to main content
Nintex Community Menu Bar

Hello,

In my workflow, I create a folder in a document library. Then I send an email to the person who started the workflow and give them the URL to upload their file to. (This is for files larger than what can be uploaded in the Nintex Start form. >25MB ) 

I want the workflow to periodically check the document library for the presence of a file. 

I can’t figure out how to do this? I thought I could get a count of files in the folder, and if it’s greater than zero the workflow will proceed. But all I’ve been able to query is the folder itself.

I used the Query a list action on the document library with a condition of ID equals the Folder ID of the folder I created. But this only returns data about the Folder, not the contents of the folder.

Any suggestions?

Thank you,

Michele

Hi ​@Michele,

Can you please clarify the environment you are using?
You have posted in our Nintex Workflow category, which is for our workflow cloud offering.
Are you running workflows from Nintex Workflow using gateway to your on-premise? 

You say a SharePoint document library. Is this on-premise or SharePoint for Office 365? If on-premise, which version are you using? 2013, 2016, 2019, SE.

This information may help us find a solution for you.
 


Hi ​@SimonMuntz - Thanks for replying to my request for help. I may have found a good solution. I’ll share it with you here. Please let me know if there is a better way to do this! I may be working too hard to get this info. :-)

I am using Nintex Workflow (formerly Nintex Automation Cloud) and SharePoint Online. (Not on-premise.)

The problem I was having is that I couldn’t find a way to get the contents of a document library folder in Nintex. I needed to check to see if somebody had uploaded a document into a specific folder in order to proceed with my main workflow.

Here is how I solved it: 

My colleague, Sara, gave me the idea to add a column named “FolderName” to the document library list.

I added that column and then created a new Nintex Workflow with a Start Event of New List Item. 

When an item is added to the library, I check if FileType property is empty. If so, then it’s a folder and I end the workflow. Otherwise, the workflow continues.

I first call a component workflow that we use to clean up spaces and special characters from the file name. Then I used the SharePoint Online - Rename a file action to rename the file (even if the name has not changed). This action gives us access to different properties of this SharePoint object than those that come in with the Start Event SharePoint object. Namely, the Folder Path. 

I remove the “/” from the folder path and update the list item FolderName column with that value.

Update FolderName column with name of folder the file is in

 

Meanwhile, in the main workflow, I need to wait for a file to be uploaded by the requestor. So, I used the Start a loop action that runs while the file count equals zero. (I created a fileCount variable.)

I added a Pause for duration and check it every 5 minutes.

And now that the FolderName column for the File type list items contain the name of the folder they are in, I can simply use the Query a list action and add the condition where FolderName = “name of the folder”. Then I set fileCount = SharePoint Object, Number of Items Returned.

Wait for file to be uploaded
Condition in the Query a list action (FolderName is a custom column added to the list)

 

At first I didn’t clean up the file name in the workflow triggered by an item added to a list. I used the Modify string actions recommended in this post to figure out the folder name from the Item URL of the start event SharePoint object. It took 3 replace actions to get to the folder name. But I ran into trouble when I added a file that had spaces in it. The file name in the Item URL had %20 for spaces, which didn’t match the file name. I could have urlencoded the file name, but it served my purposes to clean up the file name by removing spaces and special characters. And that’s when I discovered the very helpful Folder Path property which I could not find in the start event object.


Reply