i'm in trouble here! I have a sharepoint site in which there is a photo gallery list (PhotoGallery). I need to query this list do bring back the images from a specified gallery(folder). I developed a web part with a select menu which loads all the galeries(folders) inside this photo gallery. Then, when i select a specific gallery(folder), a modal shows up with the images from that gallery(folder). But i'm not able to bring the right results back. The query returns nothing but the list of all galleries(folders) of the list. No images are returned. But the funny thing about this is that when i stop the browser and copy the query already with the folder value and paste it into Caml Query Helper, the query works just fine! My query is:
var camlQ = new SP.CamlQuery();
camlQ.set_viewXml("<Where><And><Eq><FieldRef Name=\"ContentType\" /><Value Type=\"Text\">Image</Value></Eq><Contains><FieldRef Name=\"FileRef\" /><Value Type=\"Text\">" + VALUE_FROM_OPTION + "</Value></Contains></And></Where>");
var clientCtx = new SP.ClientContext.get_current();
this.results = clientCtx.get_web().get_lists().getByTitle("PHOTO_GALLERY_NAME").getItems(camlQ);
clientCtx.load(this.results);
clientCtx.executeQueryAsync(Function.createDelegate(this, function(sender, args){
// SOME CODE
}), Function.createDelegate(this, function(sender, args){
// SOME CODE
}));