0

Visual Studio 2013에 Cordova와 함께 Office 365 Mobile App을 개발 중입니다. 그래서 클라이언트 라이브러리를 사용하고 있습니다.Office 365 API SharePointClient | listitem을 얻는 방법?

나는 discoveryContext

를 사용하여 셰어 포인트 온라인에 인증 할 수 있습니다
discoveryContext.services(authContext.getAccessTokenFn('Microsoft.SharePoint')) 
    .then((function (capabilities) {    
     capabilities.forEach(function (v, i, a) { 
      var endpointUri = v.resourceId + "sites/APIWorkspace/_api"; 
      if (v.capability === 'MyFiles') { 
       sharePointClient = new Microsoft.CoreServices.SharePointClient(
        endpointUri, 
        authContext.getAccessTokenFn(v.resourceId)       
       );      
       console.log("Connected to Sharepoint");     
      }     
     }); 
    }).bind(this), function (error) { 
     console.log(JSON.stringify(error)); 
    }); 

, 어떻게에서 SharePoint Online에서 목록에 액세스 할 수 있습니다 내 질문? sharepoint.js 또는 SharePointClient에 대한 문서가 있습니까?

미리 감사드립니다.

답변

0

파일 개체를 사용하여 항목을 가져옵니다. SharePoint 설명서 here을 찾을 수 있습니다. JavaScript 샘플이 많지 않습니다. 업데이트 중입니다. Add Connected services을 통해 O365 서비스를 추가하는 경우 services\office365\scripts\typings\sharepoint.d.ts을 보면 다른 API를 찾을 수 있으며 API 호출을 쉽게 만들 수 있습니다.

sharePointClient.files.getItems().fetch().then(function (result) { 
    result.currentPage.forEach(function (item) { 
     console.log(item.type + ' "' + item.name + '"'); 
    }); 
}, function (error) { 
    console.log(error) 
}); 
+0

감사합니다. 안타깝게도 내부 서버 오류 (500)가 발생했습니다. { "statusText": "내부 서버 오류", "상태": 500, "responseURL": "https://rippleapi.herokuapp.com /xhr_proxy?tinyhippos_apikey=ABC&tinyhippos_rurl=https%3A//*****-my.sharepoint.com/sites/APIWorkspace/_api/files%3F_%3D1418802479799","response":"Value는 null 일 수 없습니다. \ r \ 매개 변수 이름 : serviceContext ","upload ": – Roman

+0

예를 들어 연결할 대상이"null "일 수 있습니다. 매개 변수 이름 : serviceContext", "responseType": "", responseXML ": null,"responseText " 이미 존재하는 사이트 모음 (endpointUri은 내가 직접 만든 문자열입니다.) 인수를 v.endpointUri로 변경하면 sharepoint.com/personal에 연결하고 sharepoint.com/sites /에 연결하지 않습니다. ... 내가 그렇게하면 4 개의 항목을 가져옵니다. 그러나 그들은 거의 완전하게 비어 있습니다. 타입과 이름은 (거의 모든 것과 같이) 정의되지 않습니다. – Roman