SharePoint Integration |
In SharePoint, document locking can be performed through the CheckOut and CheckIn functionality. To perform the document locking, do the following.
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"); }