Sharepoint 2010 - Set Editor (Modified By) for Document in Doc Lib

I found many problems to update the field "Modified By" in a document loaded programmatically in a Document Library.

After several attempts I found my solution.

Use the "vti_modifiedby" from ListItem.File.Properties.

Therefore, you must run these lines of code:

spListItem.File.Properties["vti_modifiedby"] = SPContext.CurrentWeb.CurrentUser.LoginName;
//Properties wants string
spListItem.File.Update();

It Works!
It does not works for  Document Set. I have not found the correct procedure.

If anyone knows, write me!

Comments

Popular posts from this blog

Sharepoint 2010 - Filter List/Library Web Part with XSLT and Content Editor WP

Sharepoint 2010 - Multilanguage Site - Show column in current language

Sharepoint 2010 - Enable/Disable Ribbon Button with EcmaScript