I have a very simple scenario. I am using SharePoint Online I have 2 site collections SC1 and SC2. Now i am executing a JavaScript function in SC1 and am trying to create a list in SC2 in a sub-site using CSOM. First question is, Is it possible? second question is How?

Please note that I have tried using the REST approach which works but that has a drawback that you have to make multiple ajax calls to create columns.

2 Answers 2


I've not provided whole code but you can call cross site connection using JavaScript. Take a reference from below code:

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

    var listCreationInfo = new SP.ListCreationInformation();  
    this.oList = crossSiteWeb.get_lists().add(listCreationInfo);  

},function(sender,args){ alert(args.get_message()); });

You can get reference from this link for JavaScript code in SharePoint.

  • Its giving me an error : SP.ClientContext is not a constructor anything i am missing? Commented Jun 23, 2016 at 12:55
  • Thank you it worked. The error was because of something else. Commented Jun 23, 2016 at 14:47

For SharePoint Online / Office 365, you can use JSOM to make cross-site collection calls as long as the site collections are all in the same tenant.

There are only two scenarios where you can make cross-site collection calls using the JavaScript Object Model in a SharePoint on-premises farm:

  1. Both site collections are located in the same web application and none of them is a host-named site collection. Basically the domain of both site collections needs to be the same.

  2. You make the calls from within a SharePoint-Hosted Add-in (aka App) and use the web proxy to access data from any site collections, regardless in which web application they are hosted. With this you can actually make calls to non-SharePoint resources (e.g. public web services). In SP-hosted Add-ins you can also use the cross-domain library to achieve the same results I described above at point 1.

Regarding how to do this, see Dikesh's answer. The important bit is new SP.ClientContext("http://url-of-another-siteCollection/"); where you specify the URL of the site located in the site collection where you're trying to create the list.

  • so in Sharepoint Online terms it should be in the same tenant or under the same account? Commented Jun 23, 2016 at 14:46
  • A tenant in SharePoint online is basically equivalent to a web application in SharePoint on-premise farm, as far as JSOM is concerned. I will update my answer.
    – Mihail
    Commented Jun 23, 2016 at 14:58

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.