是否可以在不更新版本的情况下使用Sharepoint客户端ObjectModel更新已创建/已修改字段?
var file = _ClientContext.Web.GetFileByServerRelativeUrl(serverRelativeUrl);
_ClientContext.Load(file);
_ClientContext.ExecuteQuery();
ListItem listItem = file.ListItemAllFields;
listItem["Created"] = info.SourceFile.CreationTime;
listItem["Modified"] = info.SourceFile.LastWriteTime;
MapMembers(listItem, info.MetaData);
listItem.Update();
列。SystemUpdate/Update(false)在Client ObjectModel中不可用。
谢谢
Microsoft.SharePoint.Client.File lp_newFile = lp_web.GetFileByServerRelativeUrl(lp_uri.LocalPath);
lp_context.Load(lp_newFile);
lp_context.ExecuteQuery();
//check out to make sure not to create multiple versions
lp_newFile.CheckOut();
ListItem lp_item = lp_newFile.ListItemAllFields;
listItem["Created"] = info.SourceFile.CreationTime;
listItem["Modified"] = info.SourceFile.LastWriteTime;
listItem.Update();
// use OverwriteCheckIn type to make sure not to create multiple versions
lp_newFile.CheckIn(string.Empty, CheckinType.OverwriteCheckIn);