Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

Need to get the name and the Site ID of a specific user using SharePoint Webservices

$
0
0

Hi,

I need to get the User's name by passing the Login Name using SharePoint OOB Web Services.

I need to pass DOMAIN\\Login ID and get the User's Info i.e. Name and the ID of a particular site.

I'm trying to use GetuserInfo:

$(document).ready(function () {


    var soapEnv = "<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>"+"<GetUserInfo xmlns=\"http://schemas.microsoft.com/sharepoint/soap/directory/\">"+"<userLoginName>DOMAIN\\Login ID</userLoginName>"+"</GetUserInfo>"+"</soap:Body>"+"</soap:Envelope>";


    $.ajax({
        url: "<http://SiteURL>/_vti_bin/usergroup.asmx",
        beforeSend: function (xhr) {
            xhr.setRequestHeader("SOAPAction","http://schemas.microsoft.com/sharepoint/soap/directory/GetUserInfo");
        },
        type: "POST",
        dataType: "xml",
        data: soapEnv,
        complete: processResult,
        contentType: "text/xml; charset=\"utf-8\""
    });
});
function processResult(xData, status) {
    alert("Status : " + status);
    alert(xData.responseText);
    console.log(xData.responseText);


}

But i get error stating that User does not exist.

Appreciate all your help.

Regards,

Sachin


Viewing all articles
Browse latest Browse all 7589

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>