Monday, August 4, 2008

Update Last Modified Date MetaData Property

// oSPListItem["Created"] = new DateTime(2007, 1, 1); // if you need to change created date
oSPListItem["Modified"] = System.DateTime.Now;
oSPListItem.UpdateOverwriteVersion();

http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.splistitem.systemupdate.aspx

SPListItem.SystemUpdate Method (Microsoft.SharePoint)
Updates the database with changes that are made to the list item without effecting changes in the modified time or modified by fields.
UpdateOverwriteVersion - you can change the settings without creating a new version. Update() will allow you to change the modified date too but if versioning is enabled it would also create a new version


No comments: