1

I want to get list of workitems that are deleted from a project.

How might I accomplish this using the RTC Java API?

Shog9
  • 156,901
  • 35
  • 231
  • 235
Neha S
  • 283
  • 1
  • 3
  • 17

1 Answers1

2

Deleting is one this, as this thread suggests:

    IWorkItem workItem = workItemClient.findWorkItemById(id, IWorkItem.SMALL_PROFILE, monitor);
    IDetailedStatus status = workItemClient.deleteWorkItem(workItem, monitor);
    
    if (!status.isOK()) {
            throw new TeamRepositoryException("Error deleting work item",
                    status.getException());
    }

    System.out.println("Deleted work item: " + idString + ".");

But listing the work items deleted is, I don't know if there is a Java API which access to the delete_items table.
See comment 11 of Task 140053:

There is a record in deleted_items table about all items that are deleted along with the timestamp of when they were deleted.

Task 149432 mentions:

Surface a delete work item action in the Eclipse UI

So there is a visible record. Enhancement 151766 mentions that "Java ETL should handle deleted Work Items", so there might be an API as well.

Note that it would only get your the ID of the deleted work item and the date of the deletion, not the work item itself.
As mentioned in this thread:

When you delete a work item, it will be lost permanently.

Sometimes, people create a kind of "Trash Can Project Area", so deleted work items are moved to, instead to be really deleted.


As the OP Neha S mentions in the comments, if the following code returns NULL, it can indicate a deletion:

IWorkItem workItem = workItemClient.findWorkItemById(id, IWorkItem.FULL_PROFILE, monitor);
Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • This deletes work items, he wants to list the ones that are already deleted – Astrogat Aug 26 '15 at 11:11
  • Suppose a particular workItem is deleted then what will I get for below statement: `IWorkItem workItem = workItemClient.findWorkItemById(id, IWorkItem.FULL_PROFILE, monitor);`? – Neha S Aug 26 '15 at 11:40
  • @Neha: You won't get anything. A deleted work items leaves only its id and date of deletion behind. Nothing else. – VonC Aug 26 '15 at 11:48
  • @NehaS yes, the full work item object is no longer available. – VonC Aug 26 '15 at 11:54
  • Then that will help me to identify whether its deleted. Thanks a lot VonC – Neha S Aug 26 '15 at 11:55