5

ECMAScript object model can only be used in SharePoint sites. So you can’t use this object model in an asp.net site to access SharePoint resources deployed in another url as this is cross-site scripting and not allowed.

But on a master page of the root site, can we access the lists present on the other sites in site collection and the lists present on sites in another site collection?

1
  • Which version of SharePoint? Commented Mar 20, 2014 at 17:11

1 Answer 1

15

You cannot make cross-sitecollection calls from javascript client object model in SharePoint 2010.

But you can make such calls in SharePoint 2013:

var crossSiteContext = new SP.ClientContext("http://url-of-another-siteCollection/");

var crossSiteWeb = crossSiteContext.get_web();

crossSiteContext.load(crossSiteWeb);

crossSiteContext.executeQueryAsync(function(){

    alert(crossSiteWeb.get_title());

},function(sender,args){ alert(args.get_message()); });
4
  • Superb. Thats great. Can you give me a reference or article explaining the js object model with example pls. For sp2013 Commented Mar 20, 2014 at 17:58
  • Please check my updated code. Commented Mar 20, 2014 at 19:47
  • Is it possible to fetch list column valur? Commented Mar 21, 2014 at 3:19
  • Follow this link for simpler examples:msdn.microsoft.com/en-us/library/office/… Commented Mar 21, 2014 at 6:25

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.