简体   繁体   English

SharePoint加载项[Office 365中的SharePoint托管应用程序] Rest api调用跨源资源共享错误?

[英]SharePoint add-in [SharePoint hosted app in Office 365] Rest api call Cross Origin Resource Sharing error?

When i tired to get list title from developer site present in SharePoint online, i get CROS error. 当我厌倦了从SharePoint Online中存在的开发人员网站获取列表标题时,我得到了CROS错误。 I have provided full permission to list and web in AppManifest.xml; 我已经在AppManifest.xml中提供了完整的列表和网站访问权限;

It is a simple ajax call that consume Sharepoint api rest services 这是一个简单的ajax调用,使用了Sharepoint api rest服务

Code:- 码:-

function ajaxcall() {
    var url1 = "https://xxxlll365.sharepoint.com/sites/devsite/_api/web/lists/getbytitle('xxx')/items?$select=Title";

    $.ajax({

        url: url1,
        dataType: 'json', //tired xml,jsonp, crossdoman:true [no big change]
        cros: true,
        success: function (result) {
            $("#div1").html(result);
        }
    });

Console Error XMLHttpRequest for https://xxxlll365.sharepoint.com/sites/devsite/_api/web/lists/getbytitle ('xxx')/items?$select=Title required Cross Origin Resource Sharing (CORS)."Error" https://xxxlll365.sharepoint.com/sites/devsite/_api/web/lists/getbytitle('xxx')/ items的控制台错误XMLHttpRequest?$ select =标题为必需的跨源资源共享(CORS)。“错误”

Tired with angularJS and got same error as above ! 厌倦了angularJS并得到与上面相同的错误!

Try include in the header these options: 尝试在标题中包含以下选项:

" Control-Allow-Origin "," https://xxxlll365.sharepoint.com ") Control-Allow-Origin ”,“ https://xxxlll365.sharepoint.com ”)

" Origin "," https://xxxlll365.sharepoint.com ") 来源 ”,“ https://xxxlll365.sharepoint.com ”)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM