I want to update the created by field in sharepoint using sharepoint web services. I tried to do it using List web service's UpdateListItems method but that did not work. Can some one tell me how to do this?
2 Answers
If I understand you correctly, you are trying to update created by column of an existing list item in a web service call right? If yes, I am afraid that is not possible. Created by field is a calculated column and can only be entered when a list item is created. Created by column takes the current user context in which the code runs and only when a new item is created.
-
In that case, can we update the modified by column using web service. May 19, 2014 at 22:29
-
yes, that should be possible, every time you try to update a list item, modified field is updated automatically. Modified field also takes the user security context in which the code runs. So make sure to login or pass credentials of the user you want to see in the modified column. "Editor" is the internal name for modified by column.blogs.msdn.com/b/michael_yeager/archive/2008/11/03/…– KenMay 19, 2014 at 23:54
If you observe the schema of Created By
field, it is a read only field. So, in order to update the Created By
field using web services, you first need to remove read only restriction on it and update the list using UpdateList
operation
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="http://schemas.microsoft.com/sharepoint/v3" StaticName="Author" FromBaseType="TRUE" Version="3" ShowInNewForm="FALSE" ShowInEditForm="FALSE" /></Method>';
removeReadOnly += '</Fields>';
See this for more information: http://sharepointnadeem.blogspot.com/2011/08/modifying-created-by-field-in.html