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 - Enable/Disable Ribbon Button with EcmaScript

Sharepoint 2010 - Customizing Quick Launch with pages

SharePoint - Add button Apply to List Item Edit Form for Saving Item without closing form