0

有很好的解决方案可以从 Office 365 获取数据,并使用客户端对象模型将其移动到另一个平台。即Wictor Wilen解决方案。它在代码后面的工作。

我试图从 Office 365 获取列表数据,到另一个平台,如 azure 项目(html 页面)。我确实尝试过使用.asmx网络服务。在 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;
 }

这可能是因为跨域问题。但这有可能以这种方式做到这一点吗?有没有人有更好的解决方案或想法来检索数据?

4

1 回答 1

1

查看此博客如何使用客户端对象模型和 JQuery 而不是 Web 服务读取 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

于 2012-03-06T11:52:13.643 回答