Tag: ms project integration

Roll Up SharePoint 2013 Tasks with Content Search Web Part

It’s exciting to see MS Project integration in SharePoint 2013 has been taken to a whole new level – Project is now treated as a first class citizen, and this means a lot for a shop like us who manage all our issues and projects via SharePoint.

I recently was tasked to roll up Project tasks from across our portal into one view- and was pretty fired up to learn that this requirement (something that would have previously required custom code) can now be accomplished with the new out of the box SharePoint 2013 Content Search Web Part.

About the Content Search Web Part

From the description of the Content Search Web Part in the SharePoint ribbon bar:

“Content Search Web Part will allow you to show items that are results of a search query you specify.
When you add it to the page, this Web Part will show recently modified items from the current site. You can change this setting to show items from another site or list by editing the Web Part and changing its search criteria.
As new content is discovered by search, this Web Part will display an updated list of items each time the page is viewed.”

Actually, the declaration “this Web Part will show recently modified items from the current site.” is not untrue but it’s not revealing the whole truth: with this web part you can actually leverage content from anywhere your search crawler goes – it’s not just limited to content on the current site where the web part resides. With the tight integration of SharePoint Search and FAST for SharePoint Search in SharePoint 2013, Microsoft added the Content Search Web Part to address the issue of not being able to cross site collections for the content aggregation. In fact, the Content Search Web Part will display all content available in the search index, regardless if it is SharePoint content or not! (As long as viewers have read rights to the content)

The Content Search Web Part can be found in the Content Roll-up category of the Web Part Gallery.

Our Requirements

In this use case of the Content Search Web Part, our goal is to show each users all their Project Tasks from across the SharePoint 2013 farm, in a list-style view. We do not want to show them Tasks that are currently in a “Completed” status.

Configure the Content Search Web Part

1. While on a SharePoint 2013 page using an account with edit privileges, click Edit Page > Insert > Web Part > Content Rollup > Content Search:

2. This will add a stock Content Search Web Part to the page. Click Edit Page > Edit Web Part to get the Web Parts Configuration Panel to display:4
3. Change the value of Select a query to Items matching a content type (System). Select the Task content type.
4. Change the value of the Restrict By App dropdown from the default “Current Site” to “Specify a URL” and then choose the root URL of your SharePoint web app (in our case, it’s https://go.itgroove.ca):
5. Click on “Switch to Advanced Mode“. On the Advanced Mode screen we can see the guts of our query – our query will look like this at this point (with our itgroove URL added):
path:”https://go.itgroove.ca”   -Status:Completed path:”https://go.itgroove.ca”  ContentTypeId:0x0108*
6. In the Keyword filter dropdown, select “Name of the user who runs the query” and click the “Add keyword filter” button, so you get the {User.Name} token added to the query text:
7. Move your cursor to the end of the current query text (with an extra space on the end). In the Property Filter dropdown, click “Show All Managed Properties”. This one is a bit sneaky as the dropdown will retract. Open the dropdown again and you will have a whole pile of Managed Properties to work from. Find and select the “Status” managed property.
8. Change the Operator dropdown (by default set to “Equals”) to Not Equals and the Select Value dropdown to “Manual“. Type in the word Completed into the input. When all this is done your query should look like this:
9. That’s it for the Build Your Query window – you can optionally tweak some of the other settings like sorting and ranking but that’s up to you and beyond the scope of this tutorial. Press OK to be returned to the web part’s configuration panel.
10. Under Number of Items to show, change the value to a max of 50.  This is not your overall record result count to show, but rather the number of items to display on one paginated page, if you choose the Control “List with Paging”. So if you choose 5 for example, this will show 5 records on the page, for which users can use the pagination arrows to navigate to the next 5 with. I’m not aware of a theoretical limit on maximum results you can have, it’s likely based on overall search limits.
11. Under the Display Templates section of the Web Part Configuration panel, change the Item dropdown to the value “Two Lines”. This will give is the simple two line classic list-style presentation of the results as opposed to the default image template. You can of course customize these templates visual styles and structure at will, with simple HTML and JavaScript. You can find some more on how to do that here.
12. Your Web Part output will now (assuming you of course have some SharePoint Task Lists populated with data) look like this:

Configure Status and AssignedTo in Search Service Application Managed Properties

13. But wait! We ain’t done yet – out of the box, it’s not going to filter the Status property filter, meaning that our current filter of -Status:Completed is having no effect. This is because by default the Task Status field is not enabled to be included in the search results (which are what, after all, the data for this web part is derived from). What we need to do is go to the Central Administration > Application Management > Manage Service Applications > Search Service Application > Queries and Results > Search Schema  page. Type in “Status” into the Filter input and click the green arrow button:

14. Click on the dropdown on the “Status” property and click “Edit/Map Property”. Ensure that the Searchable and also Allow Multiple Values checkbox is on – this will let you return the results from a Choice field. You’ll notice in our case the Mappings to crawled properties are mapped to the internal field names ows_Issue_x0020_Status and ows_Task_x0020_Status:
The output will look as so:
15. Save this and return to the main Managed Properties page. Enter “AssignedTo” in the filter and locate that Managed Property. Again, make sure Searchable and also Allow Multiple Values are checked:
16. Well, it took a bit to get to this point, but once you have the hang of this it’s not so painful. On the next search crawl update (you can kick it off manually if you just can’t wait), your Task rollup list will now show up, as desired, minus the Tasks that are Completed.

A special shout out is in order to Yaroslav Pentsarskyy for getting me going with the Content Search Web Part at http://www.youtube.com/watch?v=_7hVH2Z6p_k&feature=youtu.be