簡體   English   中英

SharePoint加載項[Office 365中的SharePoint托管應用程序] Rest api調用跨源資源共享錯誤?

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

當我厭倦了從SharePoint Online中存在的開發人員網站獲取列表標題時,我得到了CROS錯誤。 我已經在AppManifest.xml中提供了完整的列表和網站訪問權限;

這是一個簡單的ajax調用,使用了Sharepoint api rest服務

碼:-

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);
        }
    });

https://xxxlll365.sharepoint.com/sites/devsite/_api/web/lists/getbytitle('xxx')/ items的控制台錯誤XMLHttpRequest?$ select =標題為必需的跨源資源共享(CORS)。“錯誤”

厭倦了angularJS並得到與上面相同的錯誤!

嘗試在標題中包含以下選項:

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

來源 ”,“ https://xxxlll365.sharepoint.com ”)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM