7 March 2011

Setting Creater/Author in document library in sharepoint

SPUser Author = web.EnsureUser("YourUser");
currentItem["Author"] = Author.ID;
currentItem["Editor"] = Author.ID;
currentItem.SystemUpdate(false);
currentItem.Update().

For setting both Author and editor comment currentItem.SystemUpdate(false); in the above code.

No comments:

Post a Comment