请告诉我如何使用SharePoint 2010中的客户端对象模型在文档库下的文件中创建签入结帐功能
感谢kajal
答案 0 :(得分:0)
每次在SharePoint文件中创建,删除或更新元数据时
建议您在手术前检查并在手术后检查。
=======================================
//Check Out
clientContext = new Microsoft.SharePoint.Client.ClientContext("Your site here");
clientContext.Credentials = new NetworkCredential("LoginID","LoginPW", "LoginDomain");
clientContext.Load(clientContext.Web);
Microsoft.SharePoint.Client.Web web = clientContext.Web;
Microsoft.SharePoint.Client.File f = web.GetFileByServerRelativeUrl("relative path to the file");
f.CheckOut();
clientContext.ExecuteQuery();
//....... Your operation...............
//Check in
clientContext.Credentials = new NetworkCredential("LoginID","LoginPW","LoginDomain");
clientContext.Load(clientContext.Web);
Microsoft.SharePoint.Client.Web web = clientContext.Web;
Microsoft.SharePoint.Client.File f = web.GetFileByServerRelativeUrl("relative path to the file");
f.CheckIn(String.Concat("File CheckingIn at ", DateTime.Now.ToLongDateString()),
Microsoft.SharePoint.Client.CheckinType.MajorCheckIn);
clientContext.ExecuteQuery();