Archive | How-to RSS for this section

Iterate through documents in a Document Set

So, I’m a big fan of working with metadata (SharePoint views FTW!) instead of logical hierarchies (folders = boo!) and, on several occasions, I have found myself needing to run an action (a review task or approval perhaps) against all of the documents inside of a SharePoint Document Set.   But when I navigate to the Document Set I encounter a long and somewhat ugly URL for the set itself and begin the tedious work of recording the URL’s for each document.

DocSet324143

So how can I quickly retrieve all of the document URL’s?    Enter Nintex Workflow, a few action configurations and voilà!

Setup

Our Document Library (Doc Lib A in this case), which has been configured with a Document Set content type, and our first Document Set (Test Document Set A).  For realism, I’ve sprinkled it with a few Word documents, with fascinating names (such as the timeless, Test Doc 1-4!).

Then we open the Nintex Workflow Designer and create a new workflow…

For this exercise I will simply be recording each items URL in the workflow history. But, you could use your imagination here… Another scenario with the URL’s would be populating an email notification where users would need to review a document based on its metadata. Another could be that each document in the set would need to be copied to another location for a publishing or retention process, so we would need to collect its location for additional workflow actions.

Building the Workflow

First, we need to create some variables to store our data:

  • textDocSetRaw – A text variable to store each documents Context Item URL.
  • textDocSetName – A text variable to store the isolated and cleaned up Document Set name.
  • colDocument – A collection to store the list of all of the documents inside of the set.
  • textDocumentUrl – A text variable to store each documents URL.

Then we build out the workflow to perform the following tasks:

  1. Extract the Document Set Name
  2. Remove the %20’s in the name and replace them with spaces
  3. Remove the open in browser string
  4. Query our library for all of the documents in the particular set
  5. Record the URL for each document in the workflow history of the Document Set

DocSet32414

Outcome

We can now run this workflow against a specific Document Set and it will return the URL for each document inside. This is a handy tool for my SP bag. Maybe yours now?

DocSet324142

Download an exported version of this Workflow now

Process_DocSet_Workflow.nwf

Advertisements