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

Sharepoint 2013 returning results from userprofiles

$
0
0

Hello, I need some help in cleaning up the results from a search query.

I've created a new page within SharePoint 2013 and added 2 script editors.

One script editor holds a search box:

<div unselectable="on"><label unselectable="on">First Name Search: </label><input id="searchTextBox" type="text"><input id="getColleagues" type="button" value="Search"></div><div id="resultsDiv" unselectable="on"></div>

The other holds the search query:

<script src="http://site/SiteAssets/jquery.min.js"></script> <script type="text/javascript">

$(document).ready(function () {

    var spAppWebUrl = "http://site";

    $("#searchButton").click(function () {
        //var queryUrl = spAppWebUrl + "/_api/search/query?querytext='" + $("#searchTextBox").val() + "'";
		var wildcard = $("#searchTextBox").val() + "*";
		var queryUrl = spAppWebUrl + "/_api/search/query?querytext='*'&sourceid='b09a7990-05ea-4af9-81ef-edfab16c4e31'&rowlimit='500'&selectproperties='FirstName, LastName, PictureURL, SipAddress, PreferredName, WorkEmail'&refinementfilters='FirstName:"+ (wildcard) + "'";
		alert(queryUrl);
        $.ajax({ url: queryUrl, method: "GET", headers: { "Accept": "application/json; odata=verbose" }, success: onQuerySuccess, error: onQueryError });

    });

});

 function onQuerySuccess(data) {

    var results = data.d.query.PrimaryQueryResult.RelevantResults.Table.Rows.results;

    $("#resultsDiv").append('<table>');

     $.each(results, function () {

        $("#resultsDiv").append('<tr>');

        $.each(this.Cells.results, function () {

            $("#resultsDiv").append('<td>' + this.Value + '</td>');

        });

        $("#resultsDiv").append('</tr>');

    });

     $("#resultsDiv").append('</table>');

}
 
function onQueryError(error) {

    $("#resultsDiv").append(error.statusText)

}

 


</script>

I am getting results, but not just the selectedproperties: FirstName, LastName, PictureURL, SipAddress, PreferredName, WorkEmail.

Can someone help me to get just the selectedproperties of FirstName, LastName, PictureURL, SipAddress, PreferredName, WorkEmail?

Thanks


Viewing all articles
Browse latest Browse all 25064

Trending Articles



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