I am creating the webpart in my app for SharePoint 2013 and office 365. I have tried to accessing the SharePoint list in my webpart using ajax request like this,

    type: "GET",
    dataType: 'json',
    url: siteURL + "/_vti_bin/ListData.svc/" + listName,
    error: function (evt) {
    success: function (data) {
        // Processing the data.

It throws cross domain accessing error message. If i add a 'Access-Control-Allow-Origin' headers to access the cross domain then it shows "preflight is invalid redirect error" message. How to get the sharepoint list items in custom webpart.


The App runs in a different Domain, so you can't just call another Domain (the HostWeb)

You have to execute through SharePoint's own SP.RequestExecutor

See all SO posts:



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.