Item does not exist. It may have been deleted by another user

A quick post to help anyone else that is using the SharePoint CreateTaskWithContentType or CreateTask workflow activity in their workflows or composite activities and get the following error in the ULS after starting the workflow via custom code:

Item does not exist. It may have been deleted by another user.” with the error code 72ew and category “Workflow Infrastructure“.

The error reported through the UI in the list or library where the workflow was running is simply Error Occurred, so not very helpful.

The simple solution to this is that the item initiating the workflow must be checked-in.

I completely overlooked this when I was trying to debug why a workflow that was working perfectly well all of a sudden stopped and then I realised I had the item checked-out.

Moral of this story?

It’s a good idea to perform checks prior to custom code that starts a workflow containing an activity that requires a checked in item. Either that, or you could have the workflow automatically check the item in before executing any of these activities, but that would really depend on the business requirements as checking in items through code isn’t really advisable, so it’s better to ask the user to check the item in first.

Running the workflow from the out of the box context menu informs users to check the item in, so this is only required if you have a case where you initiate the workflow through code.

4 comments

  1. Howard says:

    Hello Stuart. Thanks for your post. I came across the same error message when assigning an event receiver to a content type, which I’ve blogged about here: http://spfarm.blogspot.com/2011/05/sharepoint-item-does-not-exist-it-may.html

    Cheers
    Howard

  2. rajesh says:

    Thanks you so much.this article save me a lot of time.

  3. Sheldon says:

    Thx.

  4. Ajit Gaikwad says:

    Hello,

    I got the same error when i was deleting the specific list item progrmatically.

    I observed that the item deleting event was fireing in beckend.

    I solved this problem by creating two methods for disabling & enabling the events at in event receiver and created the object of evenet receiver class and called these methods before deleting the item programatically.

    public class DeviationCalculateEventReceiver : SPItemEventReceiver
    {

    public void DisableHandleEventFiring()
    {
    this.EventFiringEnabled = false;
    }

    public void EnableHandleEventFiring()
    {
    this.EventFiringEnabled = true;
    }
    }

    DeviationCalculateEventReceiver.DeviationCalculateEventReceiver itemDeletingEvent = new DeviationCalculateEventReceiver.DeviationCalculateEventReceiver();
    itemDeletingEvent.DisableHandleEventFiring();
    oWeb.AllowUnsafeUpdates = true;
    oItem.Delete();
    oItem.Update();
    oWeb.AllowUnsafeUpdates = false;
    itemDeletingEvent.EnableHandleEventFiring();

Leave a Reply

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

Solve the maths problem shown below before posting: *

Follow

Get every new post delivered to your Inbox

Join other followers: