SharePoint: Modifying Created By field in SharePoint using web services and SPServices

I had a requirement of modifying the Created By field in a MOSS 2007 list without using Server side object model. In server side it is very easy to update the field, note that the internal name of the Created By field is Author. To update the Created By field using Server side we can write the following code.
item["Author"] = new SPFieldUserValue(web, 1, null);

I was using SPServices and not SharePoint web services directly. I tried to update the Created By field using "UpdateListItems" function but the field was not getting updated. 

  operation: "UpdateListItems",
  listName: "Users",
  ID: itemId,
  valuepairs: [["Author", userId]],
  completefunc: function (xData, Status) {
I then created another field of type person and tried to update that field and surprisingly it updated that field. Using SP Manager I found that Created By field was Read Only whereas the other field I created was not. So, that meant that before updating the value in the Created By field, the Read Only restriction from the field had to be removed.

For testing purpose, I made the Read Only value as false for the created By field in my list using SPMAnager and ran the above code and not surprisingly it updated the Created by field. So, now we need to update the schema of the Created By field before saving the value. This can be done by using UpdateList method as follows
var removeReadOnly = '<Fields>';
removeReadOnly += '<Method ID="1"><Field  ID="{1df5e554-ec7e-46a6-901d-d85a3881cb18}" ColName="tp_Author" RowOrdinal="0" ReadOnly="FALSE" Type="User" Name="Author" DisplayName="Created By" StorageTZ="TRUE" SourceID="" StaticName="Author" FromBaseType="TRUE" Version="3" ShowInNewForm="FALSE" ShowInEditForm="FALSE" /></Method>';
removeReadOnly += '</Fields>';

  operation: "UpdateList",
  listName: "Users",
  updateFields: removeReadOnly,
  newFields: "",
  deleteFields: "",
  listVersion: "",
  async: false,
  completefunc: function (xData, Status){  
Note the above Schema for Created By field can be obtained either from fieldswss.xml found in /12/Template/Features/Fields or by clicking in SchemaXml property in SPManager. As can be seen the only change in the schema is that ReadOnly="FALSE" instead of TRUE. Also, remember to Update the list again with ReadOnly="FALSE" once you save your value so that no issues are introduced.

profile for Nadeem Yousuf at SharePoint Stack Exchange, Q&A for SharePoint enthusiasts