While Getting data from SharePoint host header site collection to another host header site collection using rest API we are getting 401 unauthorized error. please help.

Source URL: http://cph.vconnect.com Dispaly Site URL: http://mysite.vconnect.com

$(document).ready(function () {

// occurs when a user clicks the read button
function getMarqueeListItem() {
    var listName = "CorpCommunication";
    var url = "http://cph.vconnect.com";
    getListItems(listName, url, function (data) {
        var items = data.d.results;
    }, function (data) {
        alert("Ooops, an error occured. Please try again");

// READ operation
// listName: The name of the list you want to get items from
// siteurl: The url of the site that the list is in. 
// success: The function to execute if the call is sucesfull
// failure: The function to execute if the call fails
function getListItems(listName, siteurl, success, failure) {
        url: siteurl + "/_api/web/lists/getbytitle('" + listName + "')/items",
        method: "GET",
        headers: { "Accept": "application/json; odata=verbose" },
        cache: false,
        success: function (data) {
        error: function (data) {


enter image description here

1 Answer 1


It looks like you should enable cors in web.config https://blog.kenaro.com/2014/03/18/cross-site-scripting-with-sharepoint-2013-rest-calls/

Or use another options: ECMAScript or custom wcf-service and access data in code-behind.

  • Thanks for your replay, In given article he describe about 2 web application but my issue is different team sites with in same web application Nov 1, 2017 at 6:25
  • In this case you have the same issue: same-origin policy doesn't work https://en.m.wikipedia.org/wiki/Same-origin_policy
    – ted
    Nov 7, 2017 at 11:57

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.