How to update a SPListitem whithout change its “modified” and “modified By” column value?
-
09-12-2020 - |
Question
I have to update only one column of Sharepoint list in server side console application.
However, if i try to update the SPListitem , the "modified" and "modified by" column will be auto update.. So how to update the list item without change the "modified" and "modified By" column value?
some code:
foreach (var item in items)
{
//get itemsite, itemsubsite, fileURL andimageData by item;
web.Files.Add(Path.Combine(itemsite, itemSubsite, fileURL), nImageData, true);//to replace the same file..
}
trying:
foreach (var item in items)
{
//get itemsite, itemsubsite, fileURL andimageData by item;
DateTime modified = (DateTime)doc["Modified"];
string modifiedBy = (string)doc["Modified By"];
web.Files.Add(Path.Combine(itemsite, itemSubsite, fileURL), nImageData, true);
doc["Modified"] = modified;
doc["Modified By"] = modifiedBy;
item.Update();//error
}
No correct solution
OTHER TIPS
foreach (var item in items)
{
item["columnOne"] = "SharePoint";
item.SystemUpdate();
}
use it it like this. Instead of update, use systemupdate
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange