Item.SystemUpdate()在SharePoint Online中不起作用 [英] Item.SystemUpdate() is not working in SharePoint online
问题描述
能否请您提供一个适用于SharePoint Online的示例代码? item.SystemUpdate()不起作用,item.Update()起作用,但是它正在更新版本.
Could you please provide me a sample code that works for SharePoint Online? item.SystemUpdate() not working and item.Update() is working but it is updating the version.
var pwd = "Password";
var securePassword = new SecureString();
foreach (char c in pwd)
{
securePassword.AppendChar(c);
}
var onlineCredentials = new SharePointOnlineCredentials("me@something.com", securePassword);
var context = new ClientContext("https://something.sharepoint.com/sites/dev1/");
context.Credentials = onlineCredentials;
List oList = context.Web.Lists.GetByTitle("Documents");
context.ExecuteQuery();
ListItem item = oList.GetItemById(1);
FieldUserValue ModifiedUserValue = new FieldUserValue();
ModifiedUserValue.LookupId = 1073741823;
item["Editor"] = ModifiedUserValue;
item["Modified"] = DateTime.Now.AddDays(-1345);
item.SystemUpdate();
context.ExecuteQuery();
它什么都不做.如果我只用item.Update()替换item.SystemUpdate(),它就可以工作.使用最新的CSOM dll.
It does nothing. If i replace item.SystemUpdate() with just item.Update(), it works. Using latest CSOM dll's. 16.1.7317.1200
阿努拉达!!
推荐答案
Anuradha,
Hi Anuradha,
SystemUpdate的概念不适用于远程操作CSOM \ REST.
The concept of SystemUpdate does not apply for remote operation CSOM\REST.
我们可以做的就是在需要的情况下直接通过权限修改更新日期和修改日期.
What we can do is to update Modified By and Modified date directly if required with right permissions.
请参考下面的MSDN博客,其中用代码片段解释了这种情况.
Kindly refer the below MSDN blog which explain this scenario with a code snippet.
这篇关于Item.SystemUpdate()在SharePoint Online中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!