1,804 articles and 14,915 comments as of Thursday, May 26th, 2011

EndUserSharePoint has combined resources with NothingButSharePoint.com. You can now find End User (Mark Miller), Developer (Jeremy Thake) and IT Pro SharePoint content all in one place!

This site is a historical archive and is no longer being updated. Please update your favorites, bookmarks and RSS feeds.

NothingButSharePoint.com
Wednesday, November 17, 2010

Inconvenient User Tasks Web Part and How to Make it Display All Tasks

Guest Author: Waldek Mastykarz
Innovation Matters

The out of the box available User Tasks Web Part allows you to show tasks assigned to the current user. This Web Part is a great building block for end users since it doesn’t require any configuration whatsoever. All you have to do is add it to a page and it will automatically display all tasks assigned to the current user. Unfortunately, by default, the User Tasks Web Part displays only tasks assigned to the current user located in tasks lists in the current Site.


The scenario

Imagine you’ve been given the assignment of creating an overview of tasks assigned to users. To make it user friendly all you want to display are the tasks for the user currently visiting the site. Although there are multiple projects where the tasks can be created you were asked to provide a single overview for the users.

Choices, choices, every time choices

Reading the first part of the requirement you might consider using the out of the box available User Tasks Web Part, which displays a list of all tasks assigned to the current user. Each task has a link attached to it so it’s easy for users to quickly see more information about a specific task. However, because of the last part of the requirement, you cannot really use the User Tasks Web Part: after all it displays tasks from the current site only. So what are the options?

Embrace the development

If you are a developer or a power-user you know that aggregating all tasks assigned to the current user isn’t that complicated. Depending on your experience and knowledge of the platform you might come up with a custom solution: either using the SharePoint API or a Data View Web Part-like solution configured through SharePoint Designer.

While there is nothing wrong with any of those approaches there is an easier way to get things done, especially if all you need to do is to display tasks from all sites using the default User Experience.

Content Query Web Part almighty

Content Query Web Part (CQWP) is probably the best content aggregation solution available on the SharePoint platform. Thanks to its built-in caching mechanisms it performs very well and since the presentation of the aggregated data relies on XSLT, it is very flexible and can be used in virtually any situation.

The great thing about using the CQWP for this purpose is the ability to configure it through the UI. Using the standard properties you can configure just the right query to retrieve tasks assigned to the current user. However, If you would like to present the retrieved tasks similarly to the standard User Tasks Web Part, it would take quite some effort to achieve the same result.

There is, yet, another way to get things done without too much work.

Customization through configuration

While it might seem impossible at first, the User Tasks Web Part ships with a hidden gem that allows you to display all tasks assigned to the current user.

Let’s start with adding the User Tasks Web Part. By default it will display all tasks assigned to the current user, stored in tasks lists in the current Site.


Although there are is one more task assigned to the current user, stored in the Team 1 site, it is not being picked up by the User Tasks Web Part we have just added.

As mentioned before, the property that allows you to change the default behavior of the User Tasks Web Part is hidden and cannot be modified through the UI. So in order to make the User Tasks Web Part display all tasks, you need to export the Web Part and change the value in the .dwp file.


After you open the .dwp file in your favorite text editor, you have to add the following snippet just before the </WebPart> tag:

<QuerySiteCollection xmlns="http://schemas.microsoft.com/WebPart/v2/Aggregation">true</QuerySiteCollection>


Important: It is important to include the xmlns attribute. If you omit it, the setting won’t work and the User Tasks Web Part will display tasks from the current site only as it does by default.

Once you do that, save the file, move back to SharePoint, upload the .dwp file and add the imported User Tasks Web Part. You should see all tasks assigned to the current user being displayed in the overview:


And that’s it. From now on, no matter where in the Site Collection a task is created and assigned to a user, it will be displayed on the overview that you have just created.

One more important thing to notice is that although I’ve used SharePoint 2010 as sample for this article, exactly the same approach can be used with SharePoint 2007.

Summary

Out of the box SharePoint ships with the User Tasks Web Part which allows you to display tasks assigned to the current user. By default this Web Part shows only tasks stored in the current Site. If all you need to do is modify the overview and include all tasks from all sites in the Site Collection, the best approach is to change the value of a hidden property of the User Tasks Web Part.

Guest Author: Waldek Mastykarz
Innovation Matters

Waldek Mastykarz is a software developer living in Alphen aan den Rijn in the Netherlands. He has been involved in web and software development for 11 years. Waldek focuses on Web Content Management solutions based on SharePoint 2007 and recently also on SharePoint 2010.

 

Please Join the Discussion

18 Responses to “Inconvenient User Tasks Web Part and How to Make it Display All Tasks”
  1. Nancy says:

    Does this only retrieve tasks present in lists that have been created or based on the Tasks list type?

  2. Nathan says:

    Not sure whether this is possible in SP2010, but in 2007 you could use the URL “YOUR SITE URL/_layouts/sitemanager.aspx” to access reports, one of which was user tasks assigned to the logged in user (you can use a URL argument in your direct link for which specific report to link to, if required). This could be done for the entire site collection if you went onto this report from the top-level site. If Publishing Features are enabled, you can just go site actions > reports > my tasks.

    Doesn’t look the prettiest, but it’s another option. Is this possible in 2010?

  3. Dan Dunne says:

    CQWP is indeed almighty, but not available in WSS (SPF2010)
    (the humble pedestrian users still need to resort code approaches…)
    Perhaps outlining the non-CQWP approach would be helpful.

  4. Dan says:

    Hi Waldek – my bad – the heart of your post is edits to the vanilla “user tasks” WP, (not a CQWP,) thus making your innovation EXTREMELY COOL for the humble pedestrian (WSS or SPF) user!

  5. Saumil Mehta says:

    Hi,
    Will this work in WSS 3.0? Tx

  6. George W says:

    I have many Inconvenient Users who ignore their Tasks.

    This will help a lot.

    Thanks!

  7. Dan says:

    One more (for the newbie w/the User Tasks WP,) is it possible to reconfigure the list view? (i.e. shown columns, sort order, group by, etc.?)

    • Waldek says:

      Unfortunately, you cannot configure the visible columns.

      • Dan says:

        Thanks, Waldek – the default WP is pretty limited in display, ( totals limit 15 items, (no ability to see all,) (can’t figure out how it’s sorting,) (what is “Item Link”?)) Has anyone else out there adventured into revising the display of the vanilla “User Tasks” WP?

  8. Nathan says:

    Can this be expanded to just the current site and down or does it have to be the whole site collection? I have a teamroom page with a tasks list. Then there is a workspace for each team event with tasks specific to that event. I’d like an “All Tasks” web part that shows the tasks for the user only for the current teamroom and it’s event workspaces below. As it is now, the OOTB User Tasks webpart shows tasks just at my teamroom level and not the workspaces under it, and your modified User Tasks webpart shows all tasks for the user for all teamrooms and other sites in the site collection. Is it possible to get in between those two and just show tasks for the current site and subsites?
    Thanks

    • Waldek says:

      Unfortunately you cannot do this with the OOTB WP without breaking it up and writing something yourself. A better solution would be to use the CQWP. The User Tasks Web Part is great if what it does is exactly what you need, but as soon as you want to change anything you will need something more powerful like the CQWP.

  9. Andreea says:

    Is it possible to modify .dwp file in order to have a User Tasks Web Part which displays the tasks assigned to all users from site, not only for the current user? How can be done this in WSS 3.0?

    Thanks!

  10. Fabian says:

    Thanks Waldek!
    I’ve got a further question.
    Is it possible to show project task in this web part, too?

    Thank you for any help!


Notify me of comments to this article:


Speak and you will be heard.

We check comments hourly.
If you want a pic to show with your comment, go get a gravatar!