2012-03-06 24 views
0

オフィス365からデータを取得し、それをクライアントオブジェクトモデル、つまりWictor Wilenソリューションを使用して別のプラットフォームに移動するための優れたソリューションがあります。そのコードの背後にある仕事。Office 365(Sharepoint Online)のjqueryまたはjavascriptを使用してlistitemを取得しますか?

私はオフィスの365からazureプロジェクト(htmlページ)のような別のプラットフォームにリストデータを取得しようとしました。 私は.asmx webservicesを使用しようとしました。それはOffice 365サイトのページで完全に機能します。しかしスクリプトが他のhtmlページ(空白のプロジェクト)に素早く動くとき。それが働いていなくても資格を渡しています。ここに私のスクリプトです。

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

このブログをチェックすると、Webサービスではなくクライアントオブジェクトモデルと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

関連する問題