Bulk Document Move

You may have built a process that moves a single document from one library to another using K2 blackpoint but did you know that the same event can handle multiple documents?  Using a combination of the Search event, to locate the group of documents that I want to move, and the Document event I can move all the documents returned from the search to a different library.  The key to making this happen is the Content Field.  The Content Field in K2 is a structure for storing information about 1 or more SharePoint artifacts.  The SharePoint search event returns the results of the search into the Content Field.  The Document event takes all the items referenced in the Content Field and moves them to another library.  Now that you understand the basics let’s take a look at the step by step.

The scenario that I am using is that I have a Contract Approval process.  During the course of this process supplementary documents are uploaded to a library that reference, in a meta data field, the contract number.  At the end of the approval process I want to take all the supplementary documents and archive them to a different library.

The first thing I need to do is find all the documents that I want to move.  To do this I am going to use the SharePoint Search event.

In the Search Event I select that I want to “Search in a SharePoint List or Library” and click Next.

image

I then select the library that I want to search.  In this case the Supplemental Documents library.

image

Now I have to define the search filter.  In this case I want to only move documents that reference the contract number of the current process instance.  The Supplemental Documents library has a meta data field that captures the Contract ID and the process instance knows the Contract ID for the current instance.  I simply add a filter to compare the two values for each item in the library.

image

On the next page I need to create a Content Field for storing the results.

image

That completes the Search event.  I now have a list of documents in my “Results” Content Field that I want to move.  To move them I use the SharePoint Documents events wizard.

In the Documents Event wizard I select that I want to Move documents from a Content Field.

image

On the next page I have to select the “Results” Content Field.

image

The next page wants to know which library to move the documents to.  At this point we could select a completely different site, site collection or even server farm but I have selected a library on the same site.

image

That completes the Documents wizard.  Here is what the resulting process looks like:

image

And there you have it, a simple way to bulk move documents in SharePoint based upon the results of a SharePoint search.


Posted Fri, Dec 4 2009 10:53 AM by k2eric