there are good solutions to get data from office 365, and move it to another platform using client object model.. i.e Wictor Wilen solution. its work in code behind.

i have tried to get list data from office 365, to another platform like azure project(html page). i did try to using .asmx webservices. that works perfectly in Office 365 Site page. but when script swift to any other html page(azure project). its not working.i have passed credentials even if they are not working. Here is my script.

 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> \

        url: "https://nexpo.sharepoint.com/_vti_bin/lists.asmx",
        type: "POST",
        dataType: "xml",
        data: soapEnv,
        processData: false,
       beforeSend : function(req) {
               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");            


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

it may be becauses of a cross domain problem. but is this possible to do this in this manner? does anyone have a better solution or idea to retrive the data?


1 Answer 1


No you can't do this using JavaScript this way. SharePoint Online is not usic Basic Authentication which you're trying to use. It's using a claims based authn, and you need to do an authn just as in the blog post you are referring to (which probably will be a nightmare to implement in JS, if even possible).

Secondly, you should use the Client Object Model (CSOM) instead of using the web services.

  • Hi wictor There are no other way to getting sharepoint online list data using jquery? Mar 6, 2012 at 9:50
  • 2
    Check out this blog. It describes how SharePoint online list data is pulled and displayed using Client Object Model and JQuery. blogs.msdn.com/b/steve_fox/archive/2011/10/05/…
    – Deepu Nair
    Mar 6, 2012 at 11:50
  • finally i solve my problem using client object model(code behind) from your reference link.Thanks @Wictor Wilen for guid me. Mar 6, 2012 at 16:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.