I am developing a Silverlight web part for SharePoint 2010. I want to set the "Author" of ListItem
in my code. So I am using the following code
internal void Save()
{
ClientContext context = ClientContext.Current
List list = context.Web.Lists.GetByTitle("Time Log");
ListItem listItem = list.AddItem(new ListItemCreationInformation());
listItem["Client"] = Client.Id;
listItem["EventDate"] = StartDateTime;
listItem["EndDate"] = EndDateTime;
listItem["Service"] = ClientService;
listItem["Description"] = Description;
listItem["Author"] = "shailesh";
listItem["Editor"] = "shailesh";
listItem.Update();
context.ExecuteQueryAsync(Success, Fail);
}
When I use this code it goes into the method "Fail" because of line listItem["Author"] = "shailesh";
. I have read that we can do it in managed client object model using credential property of ClientContext
. But it looks like that there is no way of setting "Author" in Silverlight client object model. Can you please tell any other way from which we can set the "Author" ?
If there is any way please suggest it and if possible please provide some code or give some useful link.