0

I used the following code to access the sharepoint from javascript

var soapDataString = "<soap:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'> \
                              <soap:Body> \
                                <Login xmlns='http://schemas.microsoft.com/sharepoint/soap/'> \
                                  <username>testUser</username> \
                                  <password>testPwd</password> \
                                </Login> \
                              </soap:Body> \
                          </soap:Envelope>"

        // Call web service
        $.ajax({
            url: "http://abc-xyz-sp06/YY-SHAREPOINT/_vti_bin/Authentication.asmx",
            type: "POST",
            dataType: "xml",
            data: soapDataString,
            success: resultsFeedback,
            contentType: "text/xml; charset=\"utf-8\""
        });

function resultsFeedback(xData, status) {
    alert(xData);
    alert(status);
}

I followed from this article. I even put the above code in the ready function. But the function not entering into resultsFeedback and nothing happens. I am not able to sign-in from the javascript.

5
  • 1
    Online or on premise? What SharePoint version? Commented Jan 3, 2015 at 16:11
  • I don't know the version but only the path we know. We are using that path to access the file. In Manual when we are given the path in the url, it asks for sign-in and after the credentials are given it displays the file(say for example, jpeg file)..Thanks. Commented Jan 3, 2015 at 16:17
  • 1
    Have you tried to check what response do you get in fiddler when you make this request?Also, what is the version of jQuery you are referencing? Commented Jan 6, 2015 at 9:52
  • error:function (jqXHR, textStatus, errorThrown){ console.log(errorThrown+'error login:' + jqXHR.responseText); } Add this snippet to your code after success. You will find what actually the error is. Commented Jun 16, 2015 at 21:04
  • It only works for FBA. Not for Windows Authentication Commented Aug 3, 2016 at 19:01

1 Answer 1

0

Use this url to access your resource when you do your first call to SharePoint

http://username:password@abc-xyz-sp06/YY-SHAREPOINT/YourResource.aspx

Regards

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.