Last time we covered how to create a custom search scope to find and index only the things that we want to display regardless of where they are. If you didn’t read it, you can find it here: Create a Custom My Tasks Web Part to Roll Up Tasks from everywhere Part 1

This time we will cover how to add and configure the search core results Web Part so that it displays the results we want from the custom search scope.

So to get started, go to the page that you would like to have the Web Part located on. Edit the page and add the Search Core Results Web Part. This is a default out of the box Web Part. If you don’t see it make sure that you have the search features enabled for that site collection.

Click on edit the web part and in the settings change the name to something better like “My Tasks” and then set the Cross-Web Part query ID to “User query” also add a value in the Fixed Keyword Query box to point to our new custom search scope. In this case I enter scope:”Tasks” which is what we called it in the last part.

Results Query Options

The next setting we may want to look at is the Append Text To Query field. Here we can put in values that will be used as the default query. Leaving it blank will return all results that meet the criteria of our custom search scope. We don’t want our users to have to look through everything so we set this to display what we want them see by default. For this example I added the following to this field all in one line.

TaskStatus:"In Progress" TaskStatus:"Not Started" TaskStatus:"Deferred" TaskStatus:"Waiting On Someone Else"

This will filter out the tasks that have been marked as completed. Only showing ones that have a TaskStatus of In Progress, Not Started, Deffered, or Waiting On Someone Else.

A section above in the web part properties you will see a fetched properties field. In here we can set what properties we would like to be able to show in the results. For this example we want to be able to show the assigned to and the current task status in our results. So we add <Column Name="AssignedTo"/>                                      <Column Name="TaskStatus"/>   at the end of the line but inside of the </Columns> tag.

Fetched Properties for My Task Rollup WebPart

After adding these to the fetched properties we need to change the XSL to display them. To do this click the XSL editor button in the display properties section of the web part properties and add the fields to the match=”Result” xsl:template.

If you are going through the entire example this will change later anyway. We will replace all of this XSL with the XSL we generate from the data view in the next post.

After this is in place you can apply and complete editing when you refresh your page you should see a list of tasks that are randomly scattered throughout your SharePoint farm. You will only see tasks that you have access to.

In the next post we will go through how to change the look and feel of the results to look more like a task list. We will also go through how to only display results that are assigned to the current user. This will make it look neater and cleaner and also make it much more valuable to your user as you only show them tasks that are theirs.

I know it took a long time to get this post up, I apologize I have been busy. I promise that Part 3 of this series which wraps everything up will be posted sometime this week.