Sunday, March 17, 2013

ListItem Indexer Must Use Internal Field Name
 

http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.client.listitem.item.aspx

When using client ListItem object's indexer either in Load to get the item or to set its value, the index field name must be "Internal Field Name" instead of "Display Name". This is different from server side object model with which either one will be fine.


ListItemCollection listItems = list.GetItems(query);
context.Load(listItems,
items => items.Include(
item => item.Id,
item => item["Title"],
item => item["Cloud2050EmlSubject"],
item => item["Cloud2050EmlFrom"]
));
context.ExecuteQuery();

newItem["Title"] = "New " + DateTime.Now.ToString();
newItem.Update();

No comments:

Post a Comment