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)

*爱你&永不变心* 提交于 2019-12-24 14:34:52

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/14302732/tfs-api-how-to-check-if-a-work-item-has-been-deleted-or-is-non-existent-on-the

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!