This is the query I use to get only Powerpoint files from a list:
Guid id = new Guid(reportLibrary); // ID for the Report library. Needs to be configured at the beginning of the class. List sharedDocumentsList = clientContext.Web.Lists.GetById(id); CamlQuery camlQuery = new CamlQuery(); camlQuery.ViewXml = "<Where><Eq><FieldRef Name='FileExtension'><Value Type='text'>ppt</Value></FieldRef></Eq></Where>"; ListItemCollection listItems = sharedDocumentsList.GetItems(camlQuery); clientContext.Load(sharedDocumentsList); clientContext.ExecuteQuery();
I got the query from this question: Selecting only PowerPoint files in a CAML query Sadly, the query does not do what I would expect. It still returns all the files in the list, which results in a crash further down, since the programm I wrote only expects Powerpoint files. Am I doing something wrong? Do I have to execute the query differently?