Check out a document from a workflow in SharePoint 2010

Learn how you can use a SharePoint Designer 2010 site workflow to check out a document that is located in a document library on a SharePoint Document Center site.

ADVERTISEMENTS

Suppose you have a SharePoint Document Center site of which the Document ID Service has been enabled on the site collection to which the Document Center site belongs.

This means that each document on the site can be uniquely identified by a Document ID, no matter where the document is located.

Suppose now that you want to create a SharePoint Designer 2010 workflow to be able to check out a document that has a particular Document ID.

You can create a Site Workflow with an initiation parameter and that uses a Check Out Item SharePoint Designer List Action to be able to enter a Document ID and then run the workflow to check out the document that corresponds to that Document ID under the name of the user who ran the workflow.

To create a Site Workflow that can check out a document using a Document ID:

  1. In SharePoint Designer 2010, open the Document Center site.
  2. Click Workflows in the left navigation bar.
  3. Click Workflow > New > Site Workflow on the ribbon.
  4. On the Create Site Workflow dialog box, enter a name for the workflow and click OK.
  5. Click Workflow > Variables > Initiation Form Parameters on the ribbon.
  6. On the Association and Initiation Form Parameters dialog box, click Add.
  7. On the Add Field dialog box, type DocumentID for the field name, leave Single line of text selected as the information type, and click Next.
  8. On the Add Field dialog box, leave the Default value field empty, and click Finish.
  9. On the Association and Initiation Form Parameters dialog box, click OK.
  10. Click Workflow > Insert > Action > Check Out Item on the ribbon.
  11. Click the text this field on the workflow action.
  12. On the Choose List Item dialog box, select the name of the SharePoint library containing the document you want to check out (this SharePoint library would typically be called Documents on a Document Center site).
  13. On the Choose List Item dialog box, select Document ID Value from the Field drop-down list box, and then click the formula button behind the Value field.
  14. On the Lookup for Single line of text dialog box, select Workflow Variables and Parameters from the Data source drop-down list box, select Parameter: DocumentID from the Field from source drop-down list box, leave As String selected in the Return field as drop-down list box, and click OK.
  15. On the Choose List Item dialog box, click OK. Click Yes if SharePoint Designer prompts you with a warning.
  16. Click Workflow > Save > Publish on the ribbon to publish the workflow to the SharePoint site.
  17. Test the workflow.

To test the workflow:

  1. Go to the Document Center site, and then click Site Actions > View All Site Content.
  2. On the All Site Content page, click Site Workflows.
  3. On the Workflows page under Start a New Workflow, click the name of the workflow.
  4. On the Start workflow page, type in the Document ID of the document you want to check out and click Start.

The workflow should run and redirect you back to the Workflows page when it is done running. The text Completed should be listed in the Status column of the My Completed Workflows list.

Go to the SharePoint document library where the document is located and verify that it has indeed been checked out. Note that if the document was already checked out before running the workflow, the workflow should return the status of Canceled instead of Completed.

To be able to check out any document in SharePoint 2010 using a workflow, you must first have an action that can trigger the workflow (here the manual starting and entering of a Document ID was used to trigger the workflow), and then use the Check Out Item action in SharePoint Designer to check out the document.

Note that whichever document you try to check out using a SharePoint workflow, you must have a way of identifying the document, so that it can be selected through the workflow, and then checked out. The example above used a Document ID to select a document, because a Document ID is guaranteed to be unique.

Related Articles

ADVERTISEMENTS