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

We are building a HTML 5.0+ JavaScript app which will fetch some data from a SharePoint 2010 intranet site and will display the data. The HTML 5.0 app will be developed for iPad and iPhone. When we are calling SharePoint webservices, we are getting 401 unauthorized error. The SharePoint is running on NTLM authentication. We tried using the authentication web service but that works only for FBA enabled SharePoint. We do not have the FBA enabled instance and we cannot make the happen due to organizational challenges. We have used the following code which is working partially i.e. working for IE 9.0 browser in desktops but does not work for Chrome or Safari and we get 401 error. Is there any way to use JavaScript/JQuery and achieve this? Is there any mechanism for authentication which we can use to obtain data from SharePoint? If we can pass on the credentials of the current user, that should solve the problem.

$(document).ready(function() {
    var soapEnv =
        "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'> \
            <soapenv:Body> \
                 <GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'> \
                    <listName>Country</listName> \
                    <viewFields> \
                        <ViewFields> \
                           <FieldRef Name='Title' /> \
                       </ViewFields> \
                    </viewFields> \
                </GetListItems> \
            </soapenv:Body> \

        url: "https://<siteURL>/_Vti_bin/lists.asmx",
        type: "POST",
        dataType: "xml",
        data: soapEnv,
        complete: processResult,
     xhrFields: {
    withCredentials: true

        contentType: "text/xml; charset=\"utf-8\""

function processResult(xData, status) {
    $(xData.responseXML).find("z\\:row").each(function() {
        var liHtml = "<li>" + $(this).attr("ows_Title") + "</li>";

**The code is not running in SharePoint context

Error received:

Remote Address: Request URL:https:///_Vti_bin/lists.asmx Request Method:OPTIONS Status Code:401 Unauthorized Request Headersview source Accept:/ Accept-Encoding:gzip,deflate,sdch Accept-Language:en-US,en;q=0.8,bn;q=0.6 Access-Control-Request-Headers:accept, x-requested-with, content-type Access-Control-Request-Method:POST Cache-Control:max-age=0 Connection:keep-alive Host:ph-app.eu.novartis.net Origin:null User-Agent:Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.131 Safari/537.36 Response Headersview source Content-Length:0 Date:Sun, 18 May 2014 17:11:51 GMT MicrosoftSharePointTeamServices: Server:Microsoft-IIS/7.5 Set-Cookie:NSC_qi-bqq-fv-opwbsujt_wt_TQ=ffffffff09af4e7e45525d5f4f58455e445a4a42378b;Version=1;path=/;secure;httponly SPRequestGuid:16cea8f4-2b29-4bdd-a901-11b18789f29b WWW-Authenticate:Negotiate WWW-Authenticate:NTLM X-MS-InvokeApp:1; RequireReadOnly X-Powered-By:ASP.NET

share|improve this question
Since you are not authenticating it will not work, only reason you get it to work in IE is probably due to IE forwarding the windows login credentials –  Robert Lindgren May 18 at 17:40
Yes that is precisely my question. Is there any mechanism for authentication which can be used for NTLM authentication? Any custom mechanism of passing on the credentials? –  Balmiki May 18 at 19:13
Did you find a solution to your problem ? –  AymKdn May 22 at 17:45
No. We haven't. Looks like it is not possible as is. The option we are trying now is to use Single Sign On in iPad so through Oracle identity access management which is a work around. The authentication can be changed to certificate based to solve the problem –  Balmiki May 23 at 13:52
add comment

Your Answer


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

Browse other questions tagged or ask your own question.