Tuesday, March 30, 2010

Updating sharepoint list items without updating Modified or ModifiedBy fields

New requirement as usual. Needed to update a set of list items without updating "Modified" and "Modified By" fields. Here is the code.

NOTE: UpdateOverwriteVersion() method does not create a new list item version as Update() does.

//Capture current modified fields data
_originalModified = DateTime.Parse(_listItem["Modified"].ToString());
_originalModifiedBy = _listItem["Modified By"].ToString();

_listItem["Modified"] = _originalModified;
_listItem["Modified By"] = _originalModifiedBy;

No comments:

Post a Comment