0

I am trying to get parent site calendar list data from SharePoint app page.

I have used one function for getting data. THe function name is GetParentSiteListData(). I can call this function when loading mainController in Angularjss.

Code is,

function GetParentSiteListData() {
    var getParentListurl = "https://sharepointsite.sharepoint.com/sites/mysitename" + "/_api/web/lists/getbytitle('projectCalendar')/items?$select = Id, Title";
    return $.ajax({
        url: getParentListurl,
        method: "GET",
        headers: { "Accept": "application/json; odata=verbose" },
        success: function (data) {
            console.log("GetParentSiteListData ", data);
        },
        error: function (data) {
            console.log("GetParentSiteListData Error ", JSON.stringify(data));
        }
    });
}

After loading GetParentSiteListData() function, I am getting error message like,

"GetParentSiteListData Error  
{
"readyState":4,
"responseText":"{\"error\":{\"code\":\"-2147024891,
 System.UnauthorizedAccessException\",
\"message\":{\"lang\":\"en-US\",
\"value\":\"Access denied. You do not have permission to perform this action or access this resource.\"}}}",
"status":403,
"statusText":"Forbidden"
}"

What can I do to get parent site list items to display in SharePoint app page?

0

Have a look at this article. It explains both setting the correct permissions for your app for access parent web or site and also how to make the call using REST api: https://msdn.microsoft.com/en-us/library/fp179927.aspx

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.