Basically, when we are trying to update a SharePoint List Item/Document then the item/file version is increased according to the list versioning. In the Server side object model, we can update a List Item without increasing its file version by setting ‘SystemUpdate’ as false. But in CSOM ‘SystemUpdate’ property is not supported.
In this below code block, I have mentioned how we can update a Listitem/file without changing item/file version number by using “ValidateUpdateListItem” method.
I have used a sample console application to achieve the goal. I have executed the below code sample for an SPO (O365) server and this will also work for all other SharePoint server versions except SP 2010 server.
In the code sample, I have updated the ‘Modified User’ and ‘Modified Date’ field of a SharePoint document.
The code block for this is as mentioned below,
- using System;
- using System.Security;
- using System.Collections.Generic;
- using Microsoft.SharePoint.Client;
- namespace ConsoleApp1 {
- class Program {
- static void Main(string[] args) {
- List list = null;
- Web web = null;
- User modifiedBy = null;
- ListItem item = null;
- ClientContext context = null;
- ListItemCollection itemCollection = null;
- SecureString pswd = new SecureString();
- string userName = string.Empty;
- string password = string.Empty;
- string webUrl = string.Empty;
- string modifiedDate = string.Empty;
- try {
- // Site Url to scan
- webUrl = "https://SiteUrl";
- using(context = new ClientContext(webUrl)) {
- userName = "UserName";
- password = "Password";
- foreach(char c in password.ToCharArray())
- pswd.AppendChar(c);
- // Setting credential for the above site
- context.Credentials = new SharePointOnlineCredentials(userName, pswd);
- web = context.Web;
- context.Load(web, w => w.ServerRelativeUrl, w => w.Id, w => w.CurrentUser);
- context.ExecuteQuery();
- // Getting list by Title
- list = context.Web.Lists.GetByTitle("Documents");
- context.Load(list, L => L.Id);
- // Getting all items from selected list using caml query
- itemCollection = list.GetItems(CamlQuery.CreateAllItemsQuery());
- //Loading selected list items
- context.Load(itemCollection, IC => IC.Include(I => I.Id, I => I.DisplayName, I => I.File, I => I.File.ServerRelativeUrl));
- context.ExecuteQuery();
- // The modified date will be changed to below date after the excuted successfully
- modifiedDate = "20/01/2019";
- // The modified user will be changed to current user after the code excuted successfully
- modifiedBy = web.CurrentUser;
- // Looping each item
- if (itemCollection != null && itemCollection.Count > 0) {
- for (int iCount = 0; iCount < itemCollection.Count; iCount++) {
- try {
- //getting individual list item from item collection
- item = itemCollection[iCount];
- var listItemFormUpdateValueColl = new List < ListItemFormUpdateValue > ();
- ListItemFormUpdateValue listItemFormUpdateValue = new ListItemFormUpdateValue();
- listItemFormUpdateValue.FieldName = "Modified";
- listItemFormUpdateValue.FieldValue = modifiedDate.ToString();
- listItemFormUpdateValueColl.Add(listItemFormUpdateValue);
- item["Editor"] = modifiedBy.Id;
- listItemFormUpdateValue = new ListItemFormUpdateValue();
- listItemFormUpdateValue.FieldName = "Modified_x0020_By";
- listItemFormUpdateValue.FieldValue = modifiedBy.Id.ToString();
- listItemFormUpdateValueColl.Add(listItemFormUpdateValue);
- // This method will update the ListItem properties without increasing file version
- item.ValidateUpdateListItem(listItemFormUpdateValueColl, true, "");
- context.ExecuteQuery();
- } catch (Exception ex) {}
- break;
- }
- }
- }
- } catch (Exception ex) {}
- }
- }
- }
After executing the above code, we can find that the ‘Modified User’ and ‘Modified Date’ field value is updated but the Document/File version remains the same as it was before being updated.
In the below screenshot you can verify the difference.



Tanveer KhanPosted Mar 16, 2020, 2:24 PM
This code showing me Exception on context.ExecuteQuery(). I am using Sharepoint On Premises : The IDCRL response header from server 'http://x.xx.xx.xx:34923/' is not valid. The response header value is 'Digest qop="auth",algorithm=MD5-sess,nonce="+Upgraded+v10c134199b02b8d7e01a143b41fb92616efc237c597fcd5013e523d9366b64add9c43ae3b7c7d6fc90401beefa778e27d52210259fbfd45ff",charset=utf-8,realm="x.xx.xx.xx",NTLM,Basic realm="x.xx.xx.xx"'. The response status code is 'Unauthorized'. All response headers are 'SPRequestGuid=91c43f9f-06b0-a0d1-ce58-8111a2912052, request-id=91c43f9f-06b0-a0d1-ce58-8111a2912052, X-FRAME-OPTIONS=SAMEORIGIN, SPRequestDuration=2, SPIisLatency=0, Content-Type=text/plain; charset=utf-8, Server=Microsoft-IIS/10.0, WWW-Authenticate=Digest qop="auth",algorithm=MD5-sess,nonce="+Upgraded+v10c134199b02b8d7e01a143b41fb92616efc237c597fcd5013e523d9366b64add9c43ae3b7c7d6fc90401beefa778e27d52210259fbfd45ff",charset=utf-8,realm="x.xx.xx.xxx",NTLM,Basic realm="x.xx.xx.xxx", X-Powered-By=ASP.NET, MicrosoftSharePointTeamServices=16.0.0.4327, X-Content-Type-Options=nosniff, X-MS-InvokeApp=1; RequireReadOnly, Date=Tue, 17 Mar 2020 20:08:05 GMT, Content-Length=16'.
Gopal DahalPosted Jun 10, 2019, 5:27 AM
However the properties are updated. Moderation status comes to pending. Thus its not exactly the same solution when library is enabled for content approval.
kiquenet kiquenetPosted Apr 24, 2019, 7:04 AM
Valid for office 365 ?
Ano MepaniPosted Apr 12, 2019, 9:11 AM
Can we achieve same functionality using REST API ?