Ofcourse, you can. Created By & Modified By columns are "Person or Goup" type columns. In SharePoint all the lists has these columns by default. You can't update the values of these columns from UI. But, you can do it through SharePoint APIs.
I have created .NET windows based application to update the "created by" and "modified by" columns using SharePoint APIs. I am giving the sample code snippet below.
/******** Code snippet for modifying the Created by and Modified by column values of a SharePoint List *******/
/******** Written in .Net Windows Based Application **********/
private void button3_Click(object sender, EventArgs e)
SPSite oSite = new SPSite("http://<SiteName>/");
SPWeb oWeb = oSite.OpenWeb();
SPList oList = oWeb.Lists["TestCustomList"];
SPListItemCollection oListCollection = oList.Items;
foreach (SPListItem oListItem in oListCollection)
SPFieldUserValue oUser = new SPFieldUserValue(oWeb, oWeb.CurrentUser.ID, oWeb.CurrentUser.LoginName);
// or you can hard code the value like this,
SPFieldUserValue oUser = new SPFieldUserValue(oWeb, 14, "Sowmyan Soman");
oListItem["Author"] = oUser;//created by column value = "14;#Sowmyan Soman"
oListItem["Editor"] = oUser;//modified by column value = "14;#Sowmyan Soman"
SPSite oSite = new SPSite("http://<site URL>");
SPWeb oWeb = oSite.OpenWeb();
SPList oList = oWeb.Lists["TestDocLibrary"];
SPListItem oListItem = oList.Items.GetItemById(5);
Updated : November 13 - 2008
The above code will not update the "created by" column of document library type SharePoint lists. The above code (both) will work just fine for all the lists and even it will update the "Modified by" column in SharePoint document libraries. One of my MS colleagues Vedant has posted a work-around to accomplish this update and you can find it out here
If anyone one want to know how we can do this same functionality using Powershell (codename : Monad) please see Tedd's post : http://blogs.msdn.com/tadd/archive/2008/05/22/updating-the-created-by-and-modified-by-columns-in-sharepoint-lists.aspx
SharePoint has more than ten out-of-the-box webservices which will provide lots of functionalities that
Thinks Ever had the good old System Account show up as your author or editor, oops I mean “Created
Entwicklung What you need to know about AllowUnsafeUpdates (Part 1) What you need to know about AllowUnsafeUpdates
Direkter Download: SPPD-099-2008-06-06 Aktuell SharePointCommunityCamp September 2008 (15.9./16.9.2008)
Direkter Download: SPPD-099-2008-06-06 Aktuell SharePointCommunityCamp September 2008 (15.9./16.9.2008
Whenever we create a SharePoint site we will get a default list called “Tasks”. This is one
Direkter Download: SPPD-100-2008-06-25 Behind the Scene - QIK Video Aktuell SharePointCommunityCamp September
When modifying views for a discussion list, the Created by column can only be edited to show Name or department etc. This is pointless because the only value allowed is the system account. Other columns can be edited to show a calculated value like [emailaddress from]. This value can be fetched from the element that is added to the list.
Will the code that you have written here make it possible to add another value to the "created by"-field that shows as an example where the element is origining from.
My problem is that we want to use Sharepoint as a substitute for public folders. This works great for emails sent to this list(discussion lists) from internal users. When sent from external users "the created by" shows only system account. When synchronizing this folder to outlook the message appears to be from the system account, and cannot be replied to(Thank you Microsoft). I want this system account to go away for discussions lists. The created by field should show the email-address from the sender.
Is ths possible with this code, and where is it supposed to be added
If the users are completely from outside, then we can't update the created by column with that name. You will get an idea about a work-around to this concern from this post.
However atleast the domain should be detectable by the SharePoint. But in this situation, I think you have to maintain a custom column which will keep this information and use an event handler ItemAdded or ItemAdding to update that column with the current login user's information.
You can try to attach an event handler to the list (ItemAdded or ItemAdding) and then try to get the current user's email ID and update it in the custom column. Let me know if this will work for you.
Does this approach also work for editing the "Author" field in Document Libraries. I can use this to edit in Lists fine, but when I run it with a Document Library nothing happens.
Also I tried your approach about renaming the file from your post "Programmatically rename a file inside a SharePoint document library" this renamed the document fine but the Author still wouldn't change.