1

I am using managed client object model in sharepoint and I am adding EventDate and on adding that I am catching exception which says Microsoft.SharePoint.SPFieldValueException

if (thisfield.StaticName.ToLower() == "eventdate" 
 || thisfield.StaticName.ToLower() == "enddate")
  newitem.ParseAndSetFieldValue(thisfield.InternalName, spitem[thisfield.StaticName].ToString());

Please let me know what should I do .

Thanks

  • Here is the line code if (thisfield.StaticName.ToLower() == "eventdate" || thisfield.StaticName.ToLower() == "enddate") newitem.ParseAndSetFieldValue(thisfield.InternalName, spitem[thisfield.StaticName].ToString()); – RHM Mar 16 '12 at 14:45
1

Please Follow with this Code

 ClientContext ctx = new ClientContext("http://yoursite");
List list = ctx.Web.Lists.GetByTitle("ListName");
ListItemCollection items = list.GetItems(CamlQuery.CreateAllItemsQuery());
ctx.Load(items); // loading all the fields
ctx.ExecuteQuery();

foreach(var item in items)
{
    // important thing is, that here you must have the right type
    // i.e. item["Modified"] is DateTime
    item["fieldName"] = newValue;

    // do whatever changes you want

    item.Update(); // important, rembeber changes
}
ctx.ExecuteQuery(); // important, commit changes to the server

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.