Features

  • Update SharePoint 2013 search input box to search people with the presence
  • Redirect to Profile page on selection [optional]
  • Show user picture with presence [optional]
  • Show search suggestions

Prerequisites

  • SharePoint 2013
  • jQuery 1.8.x +
  • jQuery UI JS 1.10.x
  • jQuery UI CSS 1.10.x

Solution Deployment

add-spsolution -LiteralPath "SOLUTION_LOCATION\Arya.SearchUser.wsp"
  • Activate "SearchUserFeature" for particular WebApplication from Central Admin

Manual Installation

<script src="http://code.jquery.com/jquery-1.8.3.min.js" type="text/javascript"></script>
<script src="http://code.jquery.com/ui/1.10.1/jquery-ui.min.js" type="text/javascript"></script>
<script src="/SiteAssets/jquery.searchpeople.js" type="text/javascript"></script>
<script src="/SiteAssets/imgPreload.js" type="text/javascript"></script>
<link href="http://code.jquery.com/ui/1.10.1/themes/smoothness/jquery-ui.css" type="text/css"/>
<link href="/SiteAssets/arya.searchpeople.css" type="text/css"/>
  • Add following javascript
$(document).ready(function () {
    _spBodyOnLoadFunctionNames.push("addSearchBox");
    setTimeout(addSearchBox, 1500);
});

function addSearchBox() {
    var settings = {
        mySiteUrl: "http://PROFILE_URL",
        redirectToProfilePage: true,
        maxSuggetions: 10,
        showpicture: false,
        showInitials: true,
        principleType: 1,
        showSearchSuggetions: true
    }
    $.searchPeople(settings);
}

Settings

mySiteUrl :

My site url. User will redirect to profile page url. default: ""
e.g. http://PROFILEURL/person.aspx?accountname=NETWORID

redirectToProfilePage :

If true then user will be redirected to profile page url on selection. default: false

maxSuggetions :

Maximum suggestions to display. default: 10

showpicture:

Show user picture. default: true

showInitials:

Show Gmail like text avatar in case user profile image in not available. default: false

showSearchSuggetions:

Show search suggestions. default: true

principalType:

Principal type to search. default: 1
options:
  • 0 - User, DL, SecGroup, SPGroup
  • 1 - User
  • 2 - DL
  • 4 - SecGroup
  • 8 - SPGroup

Enable search suggestions:

  • Go to Central Admin
  • Click on "Manage service applications" under "Application Management"
  • Click on Search Service Application
  • Click on "Query Suggestions" under "Queries and Results" in left navigation
  • Check "Show search suggestions" and click "Save Settings"

Search without picture


Search with picture


Contact card



jQuery PeoplePicker also uses imgPreload plugin to show spinner before loading the user picture.

Last edited Oct 20, 2014 at 4:31 PM by Hemant_Mane, version 5