.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Articles >> SharePoint >> Post New Resource Bookmark and Share   

 Subscribe to Articles

Workflow actions for document sets

Posted By:Manning       Posted Date: January 24, 2011    Points: 75    Category: SharePoint    URL: http://www.dotnetspark.com  

Document sets are a new concept in SharePoint 2010. They represent a collection of documents, similar to folders, except that they allow for additional functionality
 

This article is taken from the book SharePoint 2010 Workflows in Action. The author discusses how to create document sets and run workflows against them.

Get 40% off any version of SharePoint 2010 Workflows in Action with the checkout code dnspark40. Offer is only valid through www.manning.com.

Document sets are a new concept in SharePoint 2010. They represent a collection of documents, similar to folders, except that they allow for additional functionality. For example, it is possible to secure all of the documents in a document set at one time. If the security is applied to a folder, documents within that folder could break inheritance and would not be affected by the change. It is also possible to run workflows against document sets; you couldn't do that with simple folders. Before we dig into document sets and workflows, we need to learn how to create a document set. That will help set the stage for what the new actions bring to the table and will give an example of document sets in use.

Creating document sets


Before you can interact with document sets in a workflow, you must activate the Document Set feature and apply the content type to a document library. Follow the steps in table 1 to enable document sets in your site. Note that you must be a site collection administrator to activate the document set feature.

Table 1 Creating a document set in SharePoint 2010

Action
Steps
Result
Activate the Document Sets feature in your SharePoint site. 1.  In the root collection site, browse to Site Settings under the Site Actions menu.
2.  Click the Site collection features link under the Site Collection Administration category.
3.  Click the Activate button next to the Document Sets feature.
The Document Sets feature becomes active.
Add the Document Set content type to a Document Library. 1.  In a document library such as Shared Documents, browse to Library Settings using the Ribbon.
2.  Click the Advanced settings link under General Settings.
3.  Set Allow management of content types to Yes and click OK.
4.  At the Library Settings screen, under Content Types, click the Add from existing site content types link.
5. Highlight Document Set in the available content types list and click the Add button, then click OK.
Document sets can be created in the library by clicking the New Document menu item and choosing Document Set (figure 1).



Figure 1 Document sets are created using the New Document menu in the same way that new documents are created, as long as they have been added as a content type to the list.

Table 1 Creating a document set in SharePoint 2010, continued

Action
Steps
Result
Create a new Document Set. 1.  Click the New Document dropdown and select the Document Set content type (figure 2).
2.  In the New Document Set dialog, give the document set a name such as Sales Presentation and give it a description. Then click OK.
The Document Set is shown with no documents. To upload documents into the document set, use the Upload Document Ribbon button.

Document set workflow actions


With a document set in place, it's time to transition to how the SPD workflows interact with it. In order to interact specifically with document sets, four new workflow actions have been created.

§  Capture a Version of the Document Set-Captures a snapshot of the document set and saves it in the version history.
§  Send Document Set to Repository-Moves or copies the document set to a SharePoint 2010 Records Center, which is used to permanently store documents for archiving purposes.
§  Set Content Approval Status for the Document Set-Approves or rejects the set from within the workflow.
§  Start Document Set Approval Process-allows the user to approve or reject the set.

Capture a version of the Document Set


The Capture a Version of the Document Set action captures the current state of either the major or minor versions of all documents in a document set and saves them to the document set's version history. This allows you to take a snapshot of the document set as a whole, instead of relying on the major and minor versions of the individual documents. The action accepts two parameters, type and comment (figure 2). The type parameter determines the versions that will be captured. The choices include capturing the latest minor versions or the last major version. The comment parameter allows you to add a comment that will be stored with the captured document set version.



Figure 2 The Capture a Version of the Document Set action takes a snapshot of all the documents in the document set and saves the set to the version history with a comment.

After using this action on a document set, you can view the document set's version history using its context menu in the SharePoint interface. You'll see the latest major or minor versions, along with the comment that was captured with the action. From here, it's possible to restore the previous version of a document within the set or the entire document set.

The Capture a Version of the Document Set action could be useful when creating a presentation that includes several documents containing related information. As the presentation is developed and its documents are modified, saving a snapshot of all related documents will allow you to more easily track the progress of the presentation. You can still manage the documents individually, including their version history, if required. After capturing a version of the document set, you can view it by opening the document set from within a document library. You'll notice that the Ribbon will include a new tab called Document Set. Opening this tab will reveal the Capture Version button, which is similar to the workflow action but is used manually. There is also the Version History button, which will show you the captured document set versions (figure 3).



Figure 3 A Document Set's version history shows all the related documents at a point in time.

Clicking the Version History button for a document set will show you a version screen similar to the one used for documents, except that documents within the document set are also shown, with their respective versions (figure 4). Note that modifying the document set's properties such as the title still generates a new version of the set. The documents will not be captured or shown in the history unless you use the Capture a Version workflow action or Ribbon button again.



Figure 4 A Document Sets version history shows all of its related documents at a point in time, with individual document versions.

Send Document Set to Repository


The Send Document Set to Repository action is used to send a document set to a Records Center for p

ermanent storage of important documents. The action requires three parameters-the action, destination content organizer, and explanation (figure 5). This action parameter determines if the document set will be copied, moved, or moved with a link (a link to the final destination of the original document is left in place). The destination content organizer is the address of the Records Center Router that you will use to process the document set. A Records Center Router is configured within the Records Center to allow for the management and storage of multiple types of documents. See the example at the end of this article to learn how to configure a Records Center and a Records Center Router. Finally, this explanation is text that is associated with the record when it is placed in the Records Center.



Figure 5 The Send Document Set to Repository action sends a document set to a Records Center using data supplied in several parameters.

Brief introduction to the Records Center in SharePoint


A SharePoint Records Center is used for permanent storage of important documents. Records Centers are usually used when a company has documents that are sensitive for compliance or legal reasons. Such a company can use a Records Center to house those documents in a noneditable fashion. Those documents can also have a retention policy, such as seven years, after which they are deleted.
The Records Center can be configured to manage multiple types of documents by creating rules. These rules allow documents to be sent to one common location by a workflow or by a manual process. After they are in Records Center, they can then be routed to the correct library based on the document type or other metadata.

As we hinted earlier, a document set can be copied, moved, or moved with a remaining link. The first two options are self-explanatory, but note that a document set is converted to a zip file when it is placed in a Records Center (figure 6). Converting the document set to a zip saves storage space and allows all of the documents to be downloaded at once. The Move and Leave a Link option will store the document set in the Records Center but will leave behind a link in the list allowing users to find the document set easily. The results of the action are stored to a variable, allowing you to take further action if the action fails or succeeds.



Figure 6 Document sets that are saved to a Records Center are automatically converted to zip files, allowing them to be downloaded as a set to save storage space.

Set Content approval Status for the Document Set


Document sets, like documents, can require approval if their library is configured to require it. The Set Content Approval Status for a Document Set action is used to set the approval status of a document set. This process is usually done manually using the SharePoint interface, but this action allows it to be automated when required. The action only has two parameters, the status to apply and comments to include (figure 7). The action can be run only against the current item and cannot be used to define the status of a document set in a different library.



Figure 7 Document Set Approval status can be adjusted using the Set Content Approval Status for the Document Set workflow action.

This action would be useful to automatically approve or reject a document set after a given amount of time. It is also wise to include logic that stops the workflow if a user manually adjusts the approval status before the automatic approval is started.

Start Document Set Approval Process


The Start Document Set Approval Process action is related to the Set Document Set Approval Status action, but it is used differently. Instead of performing the approval or rejection, this action is used to start an instance of the Approval workflow on the set, prompting a user or users to review and approve or reject the document set. The Approval link is not related to a parameter; instead, it opens a new instance of the default Approval workflow as a child to the original workflow.

Document set and Records Center workflow example


The following example will illustrate using a workflow to send a document set to a Records Center. The scenario is that a document set is used to create and collect data required for a sales proposal. After the proposal is complete, it must be approved by a manager. Finally, after the client accepts the proposal, the document set must be sent to a Records Center to prevent changes for compliance and legal reasons. For instance, a signed proposal might stipulate that you provide seven employees for a total of 280 work hours per week, with no unapproved overtime. The proposal might further stipulate the salaries for each of those seven employees. Most likely, the proposal includes a completion date. All of these details that you can't change can be saved by the workflow. The first set of steps involves configuring a Records Center to which you can route document sets from your workflow. Follow the steps in table 2 to configure a Records Center in SharePoint.
Table 2 Provisioning a new Records Center in SharePoint 2010

Action
Steps
Result
Create a new site collection using the Records Center site template. From within Central Administration > Application Management, create a new site collection using the Records Center site template:
A new site collection is created using the Records Center template.
Create a new library in the Records Center to store your sales proposal document sets. 1.  Browse to the newly created Records Center and select Manage Records Center under Site Actions.
2.  Click Create a new Records Library and then click Record Library to create a new library to store document sets.
3.  Name the library Document Set Records.
4. Add the document set content type to this new library using the Content Types settings on the Library Settings page, as you did in the second action in table 5.2.
A new document library that will receive the routed document sets is created in Records Center.
Set up the set's content organizer rules. 1.  Click Manage Records Center under Site Actions again and click Create Content Organizer Rules.
2.  Click Add New Item and Fill in the Rule properties to match figures 8 and 9.

NOTE: The Content Type must be set to Document Set and the target location must point to the Document Set Records library that you previously created.
After saving the rule, documents sent to the Records Center's Drop Off Library is automatically moved to the Document Set Records library, created in the previous action, if they have the document set content type.



Figure 8 Records Center rules are used to route submitted items based on their metadata. In this case, you're going to route all document sets into a specific record library by examining the content type.



Figure 9 Conditions can be added (but are not required) using the Conditions settings. It is required to indicate where the submitted items need to be stored. Note that this target location must be configured to allow the document set content type or you will not be allowed to save the new rule.

Now that you have configured a Records Center and have configured a library to use document sets, you can use the new document-set-specific workflow actions. Records Center is a significant feature within SharePoint 2010 but, for the scope of this book, we'll focus on routing documents through workflows. With Records Center all ready to go, we can finally build our workflow. Follow the steps in table 3 to build an SPD workflow that routes document sets to Records Center.
Table 3 Creating a SPD workflow that routes document sets to Records Center

Action
Steps
Result
Create a new document library to hold the proposals. 1.  Create a document library called Proposals.
2.  Add the document set content type to the library using the Library Settings menu.
3.  Under the library's Versioning settings option, set Require content approval for submitted items to Yes.
A new document library is created to store customer proposals.
Create a new List workflow called Approve Proposal. 1.  Using SharePoint Designer, create a new List workflow called Approve Proposal in the Proposals library.
2.  Add a Set Content Approval Status for the Document Set action to the workflow and configure it to set the status to Approved and add a comment, as shown in figure 10.
3. Save and publish the workflow.
A new workflow called Approve Proposal that will handle the approval or rejection of the document set is created.



Figure 10 The Set Content Approval Status action can be used to set the status to Approved, Pending, or Rejected.

Table 3 Creating a SPD workflow that routes document sets to Records Center, continued

Action
Steps
Result
Create another workflow called Send Proposal to Records Center. 1.  Create another List workflow on the Proposals library called Send Proposal to Records Center.
2.  Add a Send Document Set to Repository action to the workflow and configure it with the URL to the Records Center's Drop Off Library (figure 11).
3.  Save and publish the second workflow.
A second workflow titled Send Proposal to Records Center is created. This workflow will route the document set to Records Center.



Figure 11 The Send Document Set to Repository action can Copy, Move, or Move and Leave a Link. In this case, it is set to Move and Leave a Link to allow users to find the proposals easily after they are sent to the Records Center.

Table 3 Creating a SPD workflow that routes document sets to Records Center, continued

Action
Steps
Result
Create a new document set called Acme Proposal. 1.  Within the Proposals document libraries, create a new Document Set named Acme Proposal by using the New Document Set option under the New Document Ribbon button.
2.  Add some documents by opening the document set and using the Upload Document Ribbon button.
A new document set on which your two workflows will execute is created.
Run the Approve Proposal workflow. 1.  Switch to the Manage tab and click the Workflows Ribbon button.
2. Run the Approve Proposal workflow.
The status of the document set changes to Approved.
Run the Send Proposal to Records Center workflow. The document set is moved to the Records Center and the original set changes to a Document Link in the Proposals library after the Content Organizer Processing timer job executes, which by default is 11:30 pm daily.

Summary


SharePoint Designer 2010 comes with a bunch of new workflow actions and conditions related to working with document sets and security. You can use workflows to route document sets to Records Center and to manage security with tools such as breaking permission inheritance or adding and removing user permissions.

Get 40% off any version of SharePoint 2010 Workflows in Action with the checkout code dnspark40. Offer is only valid through www.manning.com.




SharePoint 2010 Workflows in Action
EARLY ACCESS EDITION

Phil Wicklund
MEAP Release: May 2010
Softbound print: December 2010 (est.) | 400 pages
ISBN: 9781935182719


 Subscribe to Articles

     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend