2012-03-06 3 views
0

Office 365에서 데이터를 가져와 클라이언트 객체 모델을 사용하여 다른 플랫폼으로 옮기는 좋은 해결책이 있습니다. 즉 Wictor Wilen 솔루션입니다. 그것의 코드 뒤에 작동합니다.Office 365 (Sharepoint Online)의 jquery 또는 javascript를 사용하여 listitem을 가져 옵니까?

저는 azure 프로젝트 (html 페이지)와 같은 다른 플랫폼으로 사무실 365에서 목록 데이터를 가져 오려고했습니다. .asmx 웹 서비스를 사용해 보았습니다. Office 365 사이트 페이지에서 완벽하게 작동합니다. 그러나 스크립트가 다른 HTML 페이지 (azure 프로젝트)로 신속하게 전환 될 때. 작동하지 않는 경우에도 자격 증명을 통과했습니다. 여기에 내 대본이있다.

function GetData() 
{ 

    var soapEnv = 
     "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'><soapenv:Body><GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'><listName>Cloud</listName><query><Query></Query></query> \ 
        <viewFields> \ 
         <ViewFields> \ 
          <FieldRef Name='OfficeCountry' /> \ 
          <FieldRef Name='Title' /> \ 
         </ViewFields> \ 
        </viewFields> \ 
       </GetListItems> \ 
      </soapenv:Body> \ 
     </soapenv:Envelope>"; 

    $.ajax({ 
     url: "https://nexpo.sharepoint.com/_vti_bin/lists.asmx", 
     type: "POST", 
     dataType: "xml", 
     data: soapEnv, 
     processData: false, 
     beforeSend : function(req) { 
     req.setRequestHeader('Authorization', 
       make_base_auth ('username', 'pwd')); 
    }, 
     complete: processResult, 
     contentType: "text/xml; charset=\"utf-8\"" 
    }); 
    } 
function processResult(xData, status) { 

    $(xData.responseXML).find("z\\:row").each(function() { 

     var lititle= $(this).attr("ows_Title");    
     alert(lititle); 

    }); 
    } 

function make_base_auth(user, password) { 
    var tok = user + ':' + password; 
    var hash = Base64.encode(tok); 
    return "Basic " + hash; 
} 

이는 교차 도메인 문제가 원인 일 수 있습니다. 이런 방식으로 이것을 할 수 있습니까? 누구나 데이터를 검색 할 수있는 더 나은 솔루션이나 아이디어가 있습니까?

답변

1

웹 서비스가 아닌 클라이언트 개체 모델과 JQuery를 사용하여 SharePoint 목록 데이터를 읽는 방법을이 블로그에서 확인하십시오.

http://blogs.msdn.com/b/steve_fox/archive/2011/10/05/using-windows-azure-to-connect-lob-data-to-sharepoint-online-using-business-connectivity-services.aspx

+0

내가 나를 인도에 대한 클라이언트 개체 모델 내 요구하지만, 덕분에 Wictor Wilen의 블로그와 접근 방식에서 참조 사용했다 .. – Jigs

관련 문제