Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I am trying to get a collection of .pdf files from a certain document library, as well as their fields and values. I need three of them - DisplayName, "Barcode"(custom) and "Document Type"(also custom).

Currently I am getting the list collection like this

 CamlQuery camlQuery = new CamlQuery();
            camlQuery.ViewXml =
                @"<View>
                <Query>
                  <Where>
                    <Eq>
                      <FieldRef Name='File_x0020_Type'/><Value Type='Text'>pdf</Value>
                    </Eq>
                  </Where>
                </Query>
              </View>";
            try
            {
                ListItemCollection listItems = CurrentChosenLibrary.GetItems(camlQuery);
                clientcontext.Load(listItems, items => items.Include(
                    item => item.DisplayName,
                    item => item["Barcode"],
                    item => item["Document_x0020_Type"],
                    item => item.HasUniqueRoleAssignments));
                clientcontext.ExecuteQuery();

Now, they all load properly. However, changing them like this:

                        item["Barcode"] = "Rafal was here";
                        item["Document_x0020_Type"] = "Here as well";
                        item.Update();

...does not do anything. What am I doing wrong?

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

Did you try running this after update:

clientcontext.ExecuteQuery();
share|improve this answer
    
God, that took me a bloody hour of trying and figuring out! Thanks so much, eirikb! –  Rafał Saltarski Sep 20 '12 at 11:52
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.