TFS API: How to check if a work item has been deleted or is non existent on the TFS Server? (not if it is accessible)

StackOverflow https://stackoverflow.com/questions/14302732

  •  15-01-2022
  •  | 
  •  

문제

I am using TFS API and I need to check if a workitem has been deleted or if it does not exist.

If i use WorkItemStore.GetWorkItem(Int32) and pass the Id of a deleted Work Item here, then the message says that "The work item does not exist, or you do not have permission to access it."

I need to check only for the deleted condition and not the inaccessible condition.
I've searched in the API but could not find any way to check for it.

I need this because I need the list of workitems that have been deleted.
In my program I have a list of some existing workitems. I then need to check if any of these workitems are deleted but I don't have to care whether the logged in user has permissions to see it or not.

And in my program I need to be absolutely sure that the workitem has been deleted because I have to make some irrevertable changes for every deleted workitem from my list.

도움이 되었습니까?

해결책

You can't. If you don't have permission to open the work item, then you can't query information about it. It's a bit of chicken/egg. Even when you do have permission, you cannot be sure a workitem was deleted, or has not yet been created.

I'd run your tool as a service somewhere under a user that has project collection level permission or server level permissions to read the work items. You could also implement your own webservice which does that and then use the outcome in your tool.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top