Iam in site B . There is another site named A .I want to access a list A of site A from site B using client object model. Can I access it I am using below code.

var context = new SP.ClientContext("/sites/SI");

var web = context.get_web().getByName("Site A");

var list = web.get_lists().getByTitle('List A');

where SI is my site collection .Currently I am using this code in site B. I am not able to fetch data from site A. Please help

  • I would recommend using REST API which you can use within the JSOM development. – Stephen Feb 14 '14 at 15:44
  • What version of SharePoint? If this is 2013 then REST is a good suggestion, although with 2013 you can use ClientContext cross-SPSite anyway, and I can provide an example, but if this is 2010 it might be more difficult – eirikb Feb 15 '14 at 12:24
  • Basically; 2010: SPServices, 2013: CSOM/REST – eirikb Feb 15 '14 at 12:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.