I have a SharePoint site A, and i would like to get the list items from a list that is in a different SharePoint site say, site B.

Note: Site A and Site B are not two subsites within in the same sitecollection. There are two entirely different Sitecollections.

I tried JSOM and Rest API, all resulted in either 403/401 error or X-Frame error Content-Not-Allowed or the "There is no app context to execute this request". I also used SP.RequestExecutor.js and even that didn't work.

I'm calling this from the home page of a sharepoint site using a content editor webpart referencing a javascript file.

I also have administrative access to both sharepoint sites. However, i don't have server-side access. So all i can do is client-side changes.

The below script is called from within a content editor webpart from https://ent01.sharepoint.abc.com/teams/siteA/

        url: "https://ent03.sharepoint.abc.com/teams/siteB/Lists/GetByTitle('Employees')/Items",
        type: "GET",
        headers: {
            "accept": "application/json;odata=verbose",
        success: function (data) {
        error: function (error) {

This didn't work, so i have also tried the sample code from MSDN for cross-domain library.

 var executor = new SP.RequestExecutor("https://ent03.sharepoint.abc.com/teams/siteB/");
              method: "GET",
              headers: { "Accept": "application/json; odata=verbose" },
              success: successHandler,
              error: errorHandler

I'm actually trying to store the list data to a javascript object which i would then use it to create tasks.

  • Hard telling without seeing what you are doing, can you provide the code? Oct 26 '16 at 18:23
  • I hope this helps!
    – kurozakura
    Oct 26 '16 at 18:56
  • Do you mean you have an App and can access the Host Web but not another SiteCollection? That's by design.. I think.., an App can only access its Host Web (SiteCollection) (The site collection the App was initiated from) Oct 26 '16 at 20:39
  • As explained above, jquery call is invoked during the load of the page which is placed within the content editor web-part. So i believe the query isn't happening within an App. So i guess it is not possible to retrieve list items from another site collection without server-side configuration.
    – kurozakura
    Oct 27 '16 at 7:33

You have the following solutions to the above problem:-

  • You can use either the SharePoint feature of "Cross Site content publishing".
  • Also, you can use Search(custom "Result source") and display the results using one of the below options:-
    1. Content Search Webpart : if you have less than 50 items.
    2. Search REST API : javaScript to hit "REST API" for search to get the results and display if the items are more than 50 using plain JS or using any template supported frontend API.
    3. Search Results Webpart: the best possible way in which you can bind the result source and would also have the OOTB Pagination.

Hope this gives you several options/solutions to choose from.

  • The return result will contain more than 50 items.
    – kurozakura
    Oct 27 '16 at 7:29
  • If the results are more than 50 items I would recommend to use Search Results webpart first, if it doesn't meet your needs then you can use the Search REST API. Oct 27 '16 at 17:23

Depending on your situation, this might be a good case for using the Content Search Web Part.

  • It gets its information from the Search Service, so crossing site/site collection boundaries is possible (as long as the user has rights to see the content - security trimming still applies).
  • You can configure the query to be very specific, so you can target a single list.
  • You can create custom Display Templates to display the results, so you have a great amount of control over how the results are displayed.

Here is the first in a series of articles by Chris O'Brien on using the Content Search Web Part, and of course there are countless other resources out there for the Googling.

Your Answer

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

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