Introduction
This article explains how to use Checkout and Check-in Activity in SharePoint 2013 Workflows using Visual Studio 2013.
Step-by-step Implementation
- Open the SharePoint site and click on the icon that is available in the right side of the site and click Site contents from the menu list or click Site Contents from the Quick Launch as shown below.

- Click the add an app icon to create a List or Document Library.

- From the apps page click Document Library and provide the name as WFDocumentsCOCI in the TextBox and click Create.

- Open Visual Studio 2013 and create a new SharePoint 2013 Empty Project and provide the name and click OK.
- In the next screen provide the site collection name you want to deploy the solution and choose Deploy as Sandboxed solution option and click Finish.
- Right-click on the project and add New Item as Workflow and provide the name WFCheckoutCheckInItem to the workflow and click the Add button.
- In the next screen, provide the name of the workflow is WF Checkout CheckIn Item and choose the List Workflow option and click Next.
- In the next screen choose Document Library, history list and task list as follows and click Next

- Select the option of User Manually to start the workflow and click Finish to add it
- Drag and drop the WriteToHistory activity and provide the message as “WF Started” and “WF Completed” respectively.
- Drag and drop the WriteToHistory activity between the two WriteToHistory activities and provide the message as "Document is going to check-out..."
- Drag and drop the CheckOutItem activity and set the properties as below.

- Drag and drop the WriteToHistory activity and provide the message as "Item Checked-out successfully"
- Drag and drop the WriteToHistory activity and provide the input message as "Wait for 2 mins..."
- Drag and drop the DelayUntil activity and set Date properties as DateTime.UtcNow.AddMinutes(2)
- Drag and drop the WriteToHistory activity and provide the input message as "Item Going to Check-in..."
- Drag and drop CheckInItem activity and set the properties as shown below.

- Drag and drop the WriteToHistory activity and provide the input message as "Item Checked-in successfully"
- Build and deploy the project.
- Open the Document Library page and upload the new document and start the workflow to the library. Then see that the item has been checked out.

- Let us see the Workflow History after the document has been checked out.

- Then wait for 2 minutes and edit the document you want to change.
- Click on the Name of the document and it will open in a Word document and select the option of Edit Document and Edit the document as below or whatever you want.

- Save it and close the document.
- Again open the document and see the changes in the saved document.

- Refresh the page after 2 minutes and see that the item has been checked-in as below.

- See that the Workflow History list and the WF has been completed.

- See the changes in the timings.
Bheemu surendra reddyPosted Feb 4, 2015, 6:46 AM
Good Information for SharePoint developer