2017-08-17 88 views
0

使用登錄用戶的憑據從Office Web Addin獲取SharePoint列表項的最佳方法是什麼?辦公室網頁詞Addin

我們已經遷移到Office 365,我不知道我是否必須在AD或Office 365認證,辦公室加載項應用程序將被部署在SharePoint上的前提

我已經試過其他服務,但我不知道如何傳遞用戶令牌,進行認證。

function GetSharePointListItems() { 
    $.ajax({ 
     url: "weburl/_api/web/lists/getbytitle('listname')/Items?$select=Title,ParagraphText&$filter=ParagraphText isnotnull ", 
     type: "GET", 
     Authorization: {"Bearer " + accessToken}, 
     headers: { "accept": "application/json;odata=verbose" }, 
     success: function (data) { 
      if (data.d.results) { 
        OnSuccessSharePointData(); 
      } 
     }, 
     error: function (xhr) { 
      alert(xhr.status + ': ' + xhr.statusText); 
      OnErrorSharePointData(); 

     } 
    }); 

任何想法

+0

當你說你嘗試了休息服務時,你能澄清你的意思嗎?你有錯誤嗎? –

+0

嗨,我得到一個訪問被拒絕錯誤使用休息服務, –

回答