1

您能否告诉我如何使用 SharePoint 2010 中的客户端对象模型在文档库下的文件中创建签入签出功能

谢谢卡哈尔

4

1 回答 1

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();
于 2014-06-27T05:43:27.750 回答