I'm trying to update some fields on SPListItem but i want to prevent Modified Date/ModifiedBy fields also don't want new version. So SystemUpdate(false) is used for my case but it can not prevent that fields and change that fields with DateTime.Now and Current User. Do I missing something?

string uploadedDocfolderPath = UploadedDoc86umentsLibName + "/" + applicationNo;
SPFolder folderArchive = archiveWeb.GetFolder(uploadedDocfolderPath);
foreach (SPFile fileArchive in folderArchive.Files)
    {
        fileArchive.Item[Fields] = .....
        fileArchive.Item.SystemUpdate(false);
    } 
有帮助吗?

解决方案

Try enclosing your update inside a try, catch, finally that handles disabling/enabling other events firing.

try
{
    this.EventFiringEnabled = false;
    fileArchive.Item[Fields] = .....
    fileArchive.Item.SystemUpdate(false);
}
catch (Exception ex)
{
    // Handle exception
}
finally
{
    this.EventFiringEnabled = true;
}
许可以下: CC-BY-SA归因
scroll top