Introduction

This all started as a request from a client to hide only certain users from the people search. I’ve decided on this route because the management interface already exists to update user profiles and it would be very little work to add a user profile property, get it crawled and use that as the filter in the people search results webpart. Below I will explain how I was able to accomplish this in Office 365 but the same would work for a SharePoint 2013 on prem.

Update 1/28/2017 – I was able to test and in order for Office 365 search to pick up a newly created user profile property you must set the value of that property in at least 1 user profile. Running the reindex-user.sp1 script located here https://github.com/wobba/SPO-Trigger-Reindex will also ensure that that a full crawl happens (relatively soon somewhere between 0-8hrs possibly?)

Update 1/25/2017 – There have been many comments about Office 365 not picking up the new field. I am still evaluating the exact steps but this takes time. I recently was able to get Office 365 to pickup the custom field last night using https://github.com/wobba/SPO-Trigger-Reindex > reindex-users.ps1 script. I believe that this is what made it happen but i need more time to test.

How To

In Office 365 -> SharePoint Administration -> User Profiles


Click “Manage User Properties” under the People Group


Click “New Property”


Set the following properties (everything else leave be)

Name: HideFromPeopleSearch

Display Name: HideFromPeopleSearch

Policy Setting: Optional

Default Privacy Settings: Everyone

Search Settings -> Alias [checked]

-> Indexed [checked]





Click “OK”

Wait some amount of time for O365 to index the User Profiles and retrieve this new field.

!!! for O365 users !!! – You must set this property on at least 1 user profile before it will be picked up by the crawl. I also recommend running this script ‘reindex-users.ps1’ > https://github.com/wobba/SPO-Trigger-Reindex will also ensure that that a full crawl happens (relatively soon somewhere between 0-8hrs possibly?)

** for on prem users – kick off a FULL search crawl of your people content source**

 

You’ll know it’s ready when you can find the new Property in the Search Schema, Crawled Properties.

From the Admin Center click “search” in the left hand menu


Click “Manage Search Schema”


Click “Crawled Properties”


Enter “Hide” in the Crawled properties search box, then click the green arrow


You will see the property appear in the search results when the property has been successfully crawled.


Next you will need to create a “Managed Property”, Click On the “Managed Properties” link


Click “New Managed Property”


Enter the following information:

Property Name: HideFromPeopleSearch

Type: Text

Queryable: Checked

Retrieveable: Checked

Add Property Mapping -> People:HideFromPeopleSearch





Click Add A Mapping

Enter “Hide” in the search box, click the Find button


Select “People:HideFromPeopleSearch”, click the OK button


Leave all the other properties as-is, click OK


You will now have to wait until Office 365 runs a full crawl on your site for the property to become available in search. When this action takes place is unknown. (I’ve head 4 hours)

** for on prem users – kick off a FULL search crawl of your site content source**

Next go to the people search page

Edit the page and Edit the Web Part Properties of the People Search Core Results


Click Change Query


In the Property Filter drop down select –Show all managed properties–


Select HideFromPeopleSearch


Select “Not equals” then “Manual Value”

Enter “True” for the Manual Value

Next Click Add property filter


Click OK


Click OK in the People Search Core Results, Web Part Properties pane


Save, Check-In & Publish your page – All Set!

To manage users it’s as easy as using the User Profile Service Application, searching for a user’s profile and checking a box to save. Watch the video if you are note sure about that – http://screencast.com/t/5VGSLCt5N

Remember it won’t be instantly removed – it will take a crawl of the people source for those changes to make it to the site!!!

Comments
  • Joe B.
    Posted at 6:09 pm February 15, 2019
    Joe B.
    Reply
    Author

    User error, but my default “Type” was string, not boolean. I was following the steps to create the property and you say, “Set the following properties (everything else leave be)”, but I missed seeing the type being boolean in the pic. Not a big deal, but if you miss it, you’ll have to recreate the property…

  • Randy Chandler
    Posted at 2:44 pm May 18, 2018
    Randy Chandler
    Reply
    Author

    Hi Tom, I was just given a link to this post. Were you ever able to determine if the process you presented in your post still works and/or if modifications need to be made?

    • Tom Daly
      Posted at 4:24 am August 9, 2018
      Tom Daly
      Reply
      Author

      This worked last time I tried. You could also use an existing field in the profile to filter by.

  • Kay
    Posted at 8:31 pm November 14, 2017
    Kay
    Reply
    Author

    Hi Tom, has there been an update since you last posted your comment? I just followed your instructions (except for running the script). Wondering if anything adhttps://thomasdaly.net/2016/01/16/hiding-people-from-people-search/?replytocom=1489#respondditional needs to be done? I am hoping the HideFromPeopleSearch In Build your query window/Property Filter shows up.

    • Tom Daly
      Posted at 1:21 am February 21, 2018
      Tom Daly
      Reply
      Author

      Yes actually, good thing you bring this up. In Office 365 you are not able to use custom properties in the search queries. You will have to use a property that already exists. In the search schema you could map your custom property to an existing boolean field. In the search query webpart you would filter by this a Refinable property.

  • Umr
    Posted at 8:46 pm August 4, 2017
    Umr
    Reply
    Author

    it seems like it does not work with SharePoint 2016, SharePoint 2016 uses ADI by default and once you crate a property it does not add it in to crawled properties after full crawl. need to figure out how to add and crawl it as crawled property.

    • Umr
      Posted at 9:22 pm August 4, 2017
      Umr
      Reply
      Author

      Never mind , I had to go and enter Yes in one of the user profile property and it showed up as crawl property after full crawl.

  • Tristan Langford – Jackson
    Posted at 1:19 pm June 12, 2017
    Tristan Langford – Jackson
    Reply
    Author

    All,

    Im not sure if any of you had already found the answer but i found a question on answers.microsoft. Basically its says to use one of the refinable string properties. Im testing mine at the moment, I will let you know if i get it working.

    https://answers.microsoft.com/en-us/msoffice/forum/msoffice_o365admin-mso_dep365/custom-managed-property-not-showing-up-in-the/6174ad2d-9874-448d-845b-27cbd6145f96

    • Tristan Langford – Jackson
      Posted at 10:55 am June 13, 2017
      Tristan Langford – Jackson
      Reply
      Author

      FYI – This did work

      • Tom Daly
        Posted at 1:02 pm June 13, 2017
        Tom Daly
        Reply
        Author

        Tristan, thanks for taking the time to look into this and provide feedback. This one has been back and forth a few times with the changes that are happening in Office 365. I’ll give your suggestion a shot this week and post an update.

      • Tom Daly
        Posted at 12:31 am June 23, 2017
        Tom Daly
        Reply
        Author

        You are 100% right… they no longer let you do anything with search properties. You must use one of the exist refinable properties and map your custom property to it. They provide a bunch of generic properties for the different property types. I will update the blog posting and provide you with a credit for your effort! thanks for sharing!

  • Slavo
    Posted at 4:20 pm March 28, 2017
    Slavo
    Reply
    Author

    Hello Tom, Looks like this solution does not work. I checked on 2 tenants and can’t follow last steps. Do we have any other options ? https://blogs.technet.microsoft.com/beyondsharepoint/2016/11/11/restrict-disabled-users-in-search-results/

    • Tom Daly
      Posted at 5:43 pm March 28, 2017
      Tom Daly
      Reply
      Author

      Can you be more specific on what’s not working?

      • Slavo
        Posted at 7:56 pm March 28, 2017
        Slavo
        Reply
        Author

        can fallow your instruction till “Next go to the people search page
        Edit the page and Edit the Web Part Properties of the People Search Core Results” i do not see HideFromPeopleSearch In Build your query window/Property Filter.

        • James V
          Posted at 12:08 am April 25, 2017
          James V
          Reply
          Author

          I’m encountering the same problem. I’ve tried with two different mapped properties, tried changing the settings of the properties, but I can’t get the property to show up

        • Tom Daly
          Posted at 12:29 am April 25, 2017
          Tom Daly
          Reply
          Author

          Did you set at least 1 users’ profile with the new property? and run the re-index as suggested?

          !!! for O365 users !!! – You must set this property on at least 1 user profile before it will be picked up by the crawl. I also recommend running this script ‘reindex-users.ps1’ > https://github.com/wobba/SPO-Trigger-Reindex will also ensure that that a full crawl happens (relatively soon somewhere between 0-8hrs possibly?)

          • James V
            Posted at 12:30 am April 25, 2017
            James V
            Author

            I’ve set it on multiple users, and waited over a week so far.

          • Tom Daly
            Posted at 12:39 am April 25, 2017
            Tom Daly
            Author

            did you also run that script?

          • James V
            Posted at 12:41 am April 25, 2017
            James V
            Author

            I have not, due to the time that I’ve waited. I can try that tomorrow.

          • Tom Daly
            Posted at 12:45 am April 25, 2017
            Tom Daly
            Author

            Please let me know if it appears after you run that script. I was not able to test just waiting for it to come through because I don’t have patience. I assumed eventually it would come through (never assume anything O365). The script made it appear for me within a few hours.

          • James V
            Posted at 9:01 pm April 26, 2017
            James V
            Author

            I ran the script yesterday and just checked, the managed property is still not showing up. I noticed in another of your comments (below) you said that O365 is no longer picking up custom properties. Do you know if this is the case? I’ve never had this much trouble with on-prem SP instances

          • Tom Daly
            Posted at 12:36 am April 27, 2017
            Tom Daly
            Author

            I believe that I wrote that before I found the script. I will run another test tonight and record it.

          • Tom Daly
            Posted at 3:01 pm April 27, 2017
            Tom Daly
            Author

            damn, it’s no longer working as it once was. I verified it multiple times before making changes to this article. I will continue over the weekend and see what I can come up with.

  • Gil Doron
    Posted at 6:39 am August 21, 2016
    Gil Doron
    Reply
    Author

    have you found a way to hide from autocomplete with out rebuilding it with JS?

    • anup
      Posted at 2:31 pm January 4, 2017
      anup
      Reply
      Author

      Hi Thomas, I followed the above steps. It has been more than 24 hours and I still cant see the managed property in wep part properties.

      • Tom Daly
        Posted at 4:10 am January 25, 2017
        Tom Daly
        Reply
        Author

        Yes O365 seems to no longer pick up custom properties. Perhaps I have something wrong in the article.. not sure yet. My current suggestion is to use a pre-existing property. Looking into the real answer on why the properties are not showing up.

  • Leave a Reply to Tom Daly
    Cancel Reply

    This site uses Akismet to reduce spam. Learn how your comment data is processed.