0

I have the following code which iterates for subsites:

 while (enumSubSites.moveNext())
        {
            var Site = enumSubSites.get_current();

I want to get the associates list items from Site. Do I need to somehow set client context to retrieve list items?

1 Answer 1

0

Try like following

Get the list

var list = context.get_web().get_lists().getByTitle('List Name');

Create Query

var caml = new SP.CamlQuery();  
caml.set_viewXml("<View><Query><Where><BeginsWith><FieldRef Name='Title' /><Value Type='Text'>T</Value></BeginsWith></Where></Query></View>");  

Specify the query and load the list oject

returnedItems = list.getItems(caml);  
context.load(returnedItems);

Run asynchronously

context.executeQueryAsync(onSucceededCallback, onFailedCallback);  

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.