How to get users from sharepoint user profile using jquery

I just want to know: is there a way to get a SharePoint user using JavaScript / jQuery from the default sharepoint-2010 user profile database?

My requirement is to form an array of all users of the SharePoint site (username) and use this array in the java function (which runs behind the page on the client side) as a data source for the SPServices function.

Please provide any possible solution or any other approach for building an array for JavaScript.

thank

+3
source share
2 answers

There are two ways to do this:

+3

SPServices codeplex:

<script type="text/javascript">
$(document).ready (function() {
    $().SPServices({
        operation: "GetListItems",
        async: true,
        listName: "User Information List",
        CAMLViewFields: "<ViewFields>" +
                        "<FieldRef Name='Title' />" +
                        "</ViewFields>",
        completefunc: AttachMembersAutoComplete
    });
});
function AttachMembersAutoComplete(xmlResponse) {
    var domElementArray = $( "[nodeName=z:row]", xmlResponse.responseXML );

    var dataMap = domElementArray.map(function() {
        return {
            value: $(this).attr('ows_Title'),
        };
    });

    var data = dataMap.get();

    $("input#inputMembersAutoComplete").autocomplete({
        source: data,
        select: function(e, ui){
            var tmpHTML = ui.item['value'];
            $("#person_info").html(tmpHTML);
        }
    });
}
</script>
+1

Source: https://habr.com/ru/post/1789312/


All Articles