Skip to main content
added 114 characters in body
Source Link
SharePoint Freak
  • 1.4k
  • 7
  • 26
  • 39

I am writing code for client side object model, and I want to retrieve items with specific title, like this:

  var context = SP.ClientContext.get_current(); var web = context.get_web(); var lists = web.get_lists(); var productList = web.get_lists().getByTitle("Products"); var query = new SP.CamlQuery(); query.set_viewXml = "<Query>""<View><Query>" + "<Where><Eq>" + "<FieldRef Name='Title' />" + "<Value Type='Text'>Acer</Value>" + "</Eq></Where>" + "</Query>"Query></View>" ; var items = productList.getItems(query); context.load(items, "Include'Include(Title)"'); context.load(lists, 'Include(Title, Fields.Include(Title))'); context.load(web, "Title"); context.executeQueryAsync(success, fail); 

It's retrieving everything, and the set_viewXml is ignored. Any help?

I am writing code for client side object model, and I want to retrieve items with specific title, like this:

 var context = SP.ClientContext.get_current(); var web = context.get_web(); var lists = web.get_lists(); var productList = web.get_lists().getByTitle("Products"); var query = new SP.CamlQuery(); query.set_viewXml = "<Query>" + "<Where><Eq>" + "<FieldRef Name='Title' />" + "<Value Type='Text'>Acer</Value>" + "</Eq></Where>" + "</Query>" ; var items = productList.getItems(query); context.load(items, "Include(Title)"); context.executeQueryAsync(success, fail); 

It's retrieving everything, and the set_viewXml is ignored. Any help?

I am writing code for client side object model, and I want to retrieve items with specific title, like this:

  var context = SP.ClientContext.get_current(); var web = context.get_web(); var lists = web.get_lists(); var productList = web.get_lists().getByTitle("Products"); var query = new SP.CamlQuery(); query.set_viewXml = "<View><Query>" + "<Where><Eq>" + "<FieldRef Name='Title' />" + "<Value Type='Text'>Acer</Value>" + "</Eq></Where>" + "</Query></View>" ; var items = productList.getItems(query); context.load(items, 'Include(Title)'); context.load(lists, 'Include(Title, Fields.Include(Title))'); context.load(web, "Title"); context.executeQueryAsync(success, fail); 

It's retrieving everything, and the set_viewXml is ignored. Any help?

Source Link
SharePoint Freak
  • 1.4k
  • 7
  • 26
  • 39

query.set_viewXml retrieving everything

I am writing code for client side object model, and I want to retrieve items with specific title, like this:

 var context = SP.ClientContext.get_current(); var web = context.get_web(); var lists = web.get_lists(); var productList = web.get_lists().getByTitle("Products"); var query = new SP.CamlQuery(); query.set_viewXml = "<Query>" + "<Where><Eq>" + "<FieldRef Name='Title' />" + "<Value Type='Text'>Acer</Value>" + "</Eq></Where>" + "</Query>" ; var items = productList.getItems(query); context.load(items, "Include(Title)"); context.executeQueryAsync(success, fail); 

It's retrieving everything, and the set_viewXml is ignored. Any help?