Header

Tuesday, 26 June 2012

How to fetch all user of SharePoint using Webserivec


$(function () {      
getLoggedInUser();
            function getLoggedInUser() {
                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><GetUserCollectionFromSite xmlns="http://schemas.microsoft.com/sharepoint/soap/directory/"/></soap:Body></soap:Envelope>';

                $.ajax({
                    url: "/_vti_bin/UserGroup.asmx",
                    type: "POST",
                    dataType: "xml",
                    data: soapEnv,
                    complete: processResult,
                    contentType: "text/xml; charset=\"utf-8\""
                });
            }
            function processResult(xData, status) {
             
                $(xData.responseXML).find("User").each(function () {
                   
                       if ($(this).attr("ID") == _spUserId) {
                        var uname = $(this).attr("Name");                      
                        alert(uname);
                    }
                   
                });
            }
        });




Just need to copy paste on script of Browser and u can get all user of SharPoint and based on current login u  can find the name of current user name ...............
So simple just try this.....:
Thanks And Regards,
Shailendra Kumar Singh

No comments:

Post a Comment