Performing Document Locking

In SharePoint, document locking can be performed through the CheckOut and CheckIn functionality. To perform the document locking, do the following.

Prerequisites

Navigation

  1. In AgilePoint Envision, open a process template.
  2. Navigate to the Generic BPM stencil.
  3. On the Generic BPM stencil, drag the AgilePart AgileShape, and drop it on the process template.
  4. On the Set Context Properties Window - AgilePart, select a custom AgilePart to associate with this instance of the AgileShape.
  5. To view the entire list of properties, in the Design Tasks pane, click Show Properties.

Instructions

  1. Similar to the Rename AgilePart, implement a CheckIn/CheckOut AgilePart that handles the document locking and releasing mechanism.

    The following are some code snippets of using the SharePoint SDK to implement the CheckOut and CheckIn operation:

    public void CheckOut()
    {
           SPWeb web = new SPSite("http://virtual:101/sites/s1/s1/a37").OpenWeb(); 
           SPFile file = web.GetFile("http://virtual:101/sites/s1/s1/a37/cdl1/test.htm");
           file.CheckOut();
           Console.WriteLine("Checked Out");
    }
    public void CheckIn()
    {
           SPWeb web = new SPSite("http://virtual:101/sites/s1/s1/a37").OpenWeb(); 
           SPFile file = web.GetFile("http://virtual:101/sites/s1/s1/a37/cdl1/test.htm");
           file.CheckIn("This is the check in comment by console app.");
           Console.WriteLine("Checked In");
    }