1

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?

1

Did you try running this after update:

clientcontext.ExecuteQuery();
  • God, that took me a bloody hour of trying and figuring out! Thanks so much, eirikb! – Rafał Saltarski Sep 20 '12 at 11:52

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.