Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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> \
        </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;
 }

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?

share|improve this question
    
Just curious, what is Base64 in your javascript? –  Anatoly Mironov Mar 6 '12 at 9:19
    
i found stackoverflow.com/questions/1002179/… and than use var Base64 script. –  jigs Mar 6 '12 at 9:29
add comment

1 Answer 1

up vote 4 down vote accepted

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.

share|improve this answer
    
Hi wictor There are no other way to getting sharepoint online list data using jquery? –  Vishal_Sharepoint Mar 6 '12 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 '12 at 11:50
    
finally i solve my problem using client object model(code behind) from your reference link.Thanks @Wictor Wilen for guid me. –  jigs Mar 6 '12 at 16:39
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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