Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.
ClientContext cl = new Microsoft.SharePoint.Client.ClientContext("http://" + "mysharepoint" + "/" + SubWeb);
System.Net.NetworkCredential cred = new System.Net.NetworkCredential("myuser", "mypass", "ntuni");

cl.Credentials = cred;

ListItemCollection result;
List qrtList = cl.Web.Lists.GetByTitle(QRT_LIST_NAME);
result = qrtList.GetItems(CamlQuery.CreateAllItemsQuery());
cl.Load(result);
cl.ExecuteQuery();

foreach (ListItem item in result)
{
    if (item.FieldValues["UniqueId"].ToString() == QrtId)
    {

        item.FieldValues["R_x00e9_ponse"] = r.ResponseTxt;
        item.Update();
        qrtList.Update();        
    }
}

cl.ExecuteQuery();

My object doesnt update once i visite the sharepoint for some reason. This is wraped around a try catch and nothing gets caught.

share|improve this question
    
Adding new item works fine. –  Dr.Denis McCracleJizz Jun 19 '13 at 16:49
    
Are you sure the if statement condition is evaluating to true? Is it necessary to call qrtList.Update()? –  Chloraphil Jun 19 '13 at 18:20
    
I can put a breakpoint inside the if and it stops there. Am not sure if the qrtList.Update() is necessary. I can see the item.FieldValue["R_x00e9_ponse"] change once i go through it. Does not end up saved on the Sharepoint tho. –  Dr.Denis McCracleJizz Jun 19 '13 at 18:40
    
I just found out that i wasnt updating the Field properly. I was using item.FieldValues["MyField"] and instead i just use item["MyField"] If you want to post it as an answer Mike, i will give it to you. Thanks :) –  Dr.Denis McCracleJizz Jun 19 '13 at 18:43
    
The next thing I would try is updating a different column, with a column name with no unusual characters. –  Chloraphil Jun 19 '13 at 18:45
show 1 more comment

1 Answer

up vote 0 down vote accepted

Reference your fields without FieldValues:

item["R_x00e9_ponse"] = r.ResponseTxt;
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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