How to add custom user profile properties to the People Search Options dropdown

If you are using the OOTB FAST Search Center site template then by default you get a tab for People search on the main page. On this tab you get a Search Options link, which  brings up the dropdown box that allows you to search by certain properties of the user profile:

How do you add a custom property to this dropdown? For example, you allow users to indicate if they are a First Aid Officer in their profile. You want users to be able to search for First Aid Officers in the organisation.

To achieve this you must first define the custom property for your user profile and map it to a managed property. I will not cover this as this post is more about configuring the Search Options dropdown. Just be sure to tick the Indexed option in the Search Settings section when defining the new property.

You can control the fields being shown in the Search Options dropdown by setting the Properties property of the People Search Box (which is a web part). This property holds a piece of XML and can be edited right in the SharePoint UI by editing the web part. (This property can be found under the Miscellaneous category in the web part editor.)

OOTB, this XML is as below:

<Properties>
	<Property Name="LastName" ManagedName="LastName" ProfileURI="urn:schemas-microsoft-com:sharepoint:portal:profile:LastName"/>
	<Property Name="FirstName" ManagedName="FirstName" ProfileURI="urn:schemas-microsoft-com:sharepoint:portal:profile:FirstName"/>
	<Property Name="JobTitle" ManagedName="JobTitle" ProfileURI="urn:schemas-microsoft-com:sharepoint:portal:profile:SPS-JobTitle"/>
	<Property Name="PersonKeywords" ManagedName="PersonKeywords" ProfileURI="urn:schemas-microsoft-com:sharepoint:portal:profile:SPS-PersonKeywords">
		<EffectiveProperty Name="Responsibility" ManagedName="Responsibility" ProfileURI="urn:schemas-microsoft-com:sharepoint:portal:profile:SPS-Responsibility"/>
		<EffectiveProperty Name="Skills" ManagedName="Skills" ProfileURI="urn:schemas-microsoft-com:sharepoint:portal:profile:SPS-Skills"/>
		<EffectiveProperty Name="Interests" ManagedName="Interests" ProfileURI="urn:schemas-microsoft-com:sharepoint:portal:profile:SPS-Interests"/>
	</Property>
</Properties>

As you can see the four Property elements in the XML map to the four options you see on the dropdown. The attributes of each Property element is pretty self-explanatory:

  • Name: appears to be the display name that will appear on the dropdown
  • ManagedName: the name of the managed property that will be searched
  • ProfileURI: this is the name of the crawled property. You can get this by viewing the crawled property in Central Admin as shown below:

 

So, to add my First Aid Officer field, I would use this XML:

<Properties>
	<Property Name="LastName" ManagedName="LastName" ProfileURI="urn:schemas-microsoft-com:sharepoint:portal:profile:LastName"/>
	<Property Name="FirstName" ManagedName="FirstName" ProfileURI="urn:schemas-microsoft-com:sharepoint:portal:profile:FirstName"/>
	<Property Name="JobTitle" ManagedName="JobTitle" ProfileURI="urn:schemas-microsoft-com:sharepoint:portal:profile:SPS-JobTitle"/>
	<Property Name="Is First Aid Officer" ManagedName="IsFirstAidOfficer" ProfileURI="urn:schemas-microsoft-com:sharepoint:portal:profile:IsExecutiveAssistant"/>
	<Property Name="PersonKeywords" ManagedName="PersonKeywords" ProfileURI="urn:schemas-microsoft-com:sharepoint:portal:profile:SPS-PersonKeywords">
		<EffectiveProperty Name="Responsibility" ManagedName="Responsibility" ProfileURI="urn:schemas-microsoft-com:sharepoint:portal:profile:SPS-Responsibility"/>
		<EffectiveProperty Name="Skills" ManagedName="Skills" ProfileURI="urn:schemas-microsoft-com:sharepoint:portal:profile:SPS-Skills"/>
		<EffectiveProperty Name="Interests" ManagedName="Interests" ProfileURI="urn:schemas-microsoft-com:sharepoint:portal:profile:SPS-Interests"/>
	</Property>
</Properties>

And here is the result:

The last thing to note is if your property is a boolean (yes/no), then you will have to use 1 or true as the search value.

Advertisements

About Bernado

Based in Australia, I am a freelance SharePoint and Dynamics CRM developer. I love developing innovative solutions that address business and everyday problems. Feel free to contact me if you think I can help you with your SharePoint or CRM implementation.
This entry was posted in Search, SharePoint 2010. Bookmark the permalink.

6 Responses to How to add custom user profile properties to the People Search Options dropdown

  1. Jennie C. says:

    Hi there. Thanks for the post. I’ve got this more or less working, but “Name” is not what shows as the display name in the drop-down. Are you certain of this?

    • Bernado says:

      Hey Jennie, yes you are right that the Name attribute does not reflect the display name for the 4 OOTB properties. This baffled me too. However, I set the Name attribute to be the display name I wanted for my custom property – and that worked. I did not have time to investigate further, but let me know what you find.

    • Alex S. says:

      Do you find a solution for the display name problem?

  2. Chuong says:

    Where do I find the XML that I would need to modify in order to add additional fields to the Search Options?

    Thank you

    • Bernado says:

      Hi Chuong,

      Edit the People Search Box web part on the page. In the web part editor pane on the right, expand the Miscellaneous section. In that section you’ll find the Properties setting. That’s the setting containing the XML that you need to edit.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s