Item.SystemUpdate()在SharePoint Online中不起作用 [英] Item.SystemUpdate() is not working in SharePoint online

查看:86
本文介绍了Item.SystemUpdate()在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.

https: //blogs.msdn.microsoft.com/vesku/2014/08/26/system-update-for-sharepoint-list-items-using-app-model/ 


这篇关于Item.SystemUpdate()在SharePoint Online中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆