SharePoint bug: mysterious deleted tasks

In the June 2016 CU for SharePoint 2013, there’s a bugfix for a problem we’ve been researching for some time. The bug itself was found by my colleague Said El Yaghmouri.

We submitted a bugreport to Microsoft. Here’s a recap of that report.


When I delete a document set in the document library, non-related tasks are deleted from the task list.
After deleting the document set, I check if the related tasks are deleted. The related tasks are indeed deleted but also (and incorrect) some other tasks are deleted. The incorrectly deleted tasks have no relation to the deleted document set. They have a lookup value to a different document set or even a blank/empty lookup field.
This issue occurs on any type of list with a lookup column set to the document library and ‘Cascading Delete’ set, not just the Task list.

This issue also effects multiple lists, as long as they have a lookup column to the document library and ‘Cascading Delete’is set.

After some research we found the issue:
It seems that the cascading delete removes all the tasks that have an ID that corresponds with the (list item) ID’s of the documents inside the deleted document set.

Expected behavior

Only the explicitly related tasks to a (to be) deleted document set should be deleted.

Steps to reproduce the problem

Setup environment

  • Create a new SiteCollection (In this example: “Case”)
  • Go to Documents > Library Settings > Advanced Settings
    • Allow management of content types > Set this value to Yes
  • Go to Documents > Library Settings > Content Types
    • Add from existing site content types:
      • Add Document Set > Click OK
  • Go to Site Content
    • Add an list (via Add an app), based on Tasks
      • Name: MyTasks
  • Go to MyTasks > Settings
    • Create column
      • Name: RelatedDocSet
      • Type is Lookup: Documents on ID
      • Enforce Cascading Delete

Setup data

  • Go to Documents
    • Add a document set (in example: Test docset)
    • Add 2 documents (in example: Test Document 1 & Test Document 2)
    • Customize the default view to show the ID of the documents
      Note the ID’s of the test documents: 3 & 4
  • Go to MyTasks
    • Create a number of tasks with NO relation to a document set.
      RelatedDocSet is set to (None).
    • Make sure there are tasks that have ID 3 & 4

Trigger the cascading delete

  • Go to Documents
    • Open the document set (in example: Test docset)
    • Open the ribbon tab ‘Manage’
    • Click on Delete
    • Confirm the delete action by pressing OK
  • Go to the created list (in example: MyTasks)
    • Check what tasks are deleted
    • In this example taskitems with ID 3 & 4 should still be there as they have not relation to the deleted document set.
    • Tasks with ID 3 & 4 are not there anymore !!

Leave a Reply

Your email address will not be published. Required fields are marked *