Remove orphaned tasks from the aggregated task list on MySite in SharePoint 2013

For some reason a deleted task was still visible in the aggregated task list for a end-user. The task itself had been deleted from the source site, so when you clicked the task you got an error message telling you it did not exist anymore. The problem was that SharePoint was unable to remove the task from the aggregated view, so now we had to deal with a ghost task!

Solution

The new task aggregation is performed with the help of the Service Application "Work Management Service", and the users MySite. When the service has aggregated your tasks, it stores the data itself in a list called "WmaAggregatedList_User". Since it is a traditional list,  you might think: "This is easy! Just go to the list and delete the task!". Sorry, but no. This list is only intended as a system list, and nothing we ever should care about, so it's actually has no available views.

Step-by-step to remove the task

  1. Start "SharePoint Manager 2013" on one server in the farm (download from CodePlex)
  2. Navigate to the correct web application, and locate the users MySite site collection under "/personal" or your preferred managed path.
  3. Expand the structure and locate the list "WmaAggregatorList_User", and choose to browse the "GridView". If the user doesn't have to many tasks, you should now be able to use this to visualy inspect the data.
  4. Locate the column named "TxEditUrl" and verify that it matched the URL of the ghost task. In my case I ignored the "&source=" end of the URL. Make a note of the list item ID for the task (the first column)
  5. Fire up good old "SharePoint 2013 Management Shell" to do some PowerShell magic.
  6. Example how to locate the task and remove it:

[code language="powershell"]

# Open the users personal site colletion and retrieve the list
$web = Get-SPWeb "http://mysite/personal/adamb"
$list = $web.Lists["WmaAggregatorList_User"]

# Get the task with the ID located with SharePoint Manager
$item = $list.GetItemById(1) # NOTE: Use the correct ID here

# Now delete the task
$list.Items.DeleteItemById(1)

[/code]

Summary

In some very rare cases, you can end up with users having orphaned tasks in their aggregated task list on MySite. I never got a understanding why this happened, but it was possible to remove this and get thing back to normal.