Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have a search page that I am building that I would like to have display a list of users based on the value in their User Profile.

Some background on our site:

In our SharePoint site, we have an embedded custom web part in our master page that displays a drop down list of values that is stored in their User Profile. The values are a list of Franchise Numbers called UserFranchises. When they select a Franchise, it feeds the value into another field in the User Profile called PreferredFranchise. This only holds one value and changes whenever they select a different franchise from their personal list.

I generally use the Current User Filter and wire the PreferredFranchise field to whatever web part I want to use this as a parameter. So far this is generally used for SSRS reports to display data only pertinent to the user. Unfortunately, I was unable to find a search web part that will accept a parameter from a filter web part.

So, onto my issue…

Using this guide: http://www.sharepointconfig.com/2011/05/how-to-create-a-simple-sharepoint-2010-people-directory/

I was able to configure the Enterprise Search page and use the Append Text To Query field within the People Search Core Results web part to display all users using the contentclass:spspeople query. This works perfectly to display all users.

At this point, I discovered within the People Refinement Panel on the Enterprise Search page that the UserFranchises field was displaying as a Managed Metadata Column. (Unfortunately, this does not display all of the choices that can be found in the field…)

I can perform a search using the franchise number and get a return of all users with that franchise in their UserFranchises field, so I know that search can return results. But how can I wire this in directly without the user having to type in the search? I want it to look at their PreferredFranchise in their profile and use it as a search parameter.

So I figure there must be some way for me to feed in the PreferredFranchise field value of the logged in user into the Append Text To Query field, but for the life of me, I have not found a way to do it.

Any ideas?

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

Matt, there are a couple ways to do this, some are a bit clunky but don't require code, other would require code. Try these:

  1. Have the custom web part add the PreferredFranchise to the query string (pages/foo.aspx?PreferredFranchise=20123) then use a people search results web part to present the results. The web part will pick up the queryString. (You may have to fiddle with the UserQuery location setting.)
  2. Use a custom web part to read the PreferredFranchise value and perform the query for you. You can do this by subclassing the Core Search Results web part. Should not be more than 10 lines of code.
  3. I need to note here that this is WAY easier in 2013...:)

Matthew

share|improve this answer
    
Thanks very much for your answer! I'll try these out and see how they work. I'll post my results... I knew you'd have an answer for this one! –  Matt.Engel_TMTI Aug 23 '13 at 12:37
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.