How to get WIs from query and display them?
-
6 มีนาคม 2555 10:32
H!
I need create, run and display a query programmatically from VS add-in. But also I should get some WI from the query. Before I've used next schema:
DTE2 _applicationObject; TfsTeamProjectCollection _tfsCollection; Project _activeProject; void QueryProcessing() { var myDocumentService = _applicationObject.GetObject("Microsoft.VisualStudio.TeamFoundation.WorkItemTracking.DocumentService") as DocumentService; var strQuery = "some query"; var myQueryDocument = myDocumentService.CreateQuery(_tfsCollection, _activeProject.Name, true, strQuery, this); var myResultsDocument = myDocumentService.CreateLinkResults(myQueryDocument, this); myDocumentService.ShowResults(myResultsDocument); myResultsDocument.Release(this); }But in that schema I can't find how to get WorkItemCollection to choose some WI. Therefore I'm trying to use WorkItemStore:
DTE2 _applicationObject; TfsTeamProjectCollection _tfsCollection; Project _activeProject; void QueryProcessing() { var strQuery = "some query"; var queryCollection = _tfsCollection.GetService<WorkItemStore>().Query(strQuery); // How to display the query? }
In that schema I have a good possibility to work with WI collection, but how to display? Or should I use DocumentService too?
ตอบทั้งหมด
-
6 มีนาคม 2555 11:54
Andrej,
You can check this very nice example by Tarun Arora:
TFS 2010 SDK: Get Projects, Iterations, Area Path, Queries and Work Items Programmatically
Please remember to mark the replies as answers if they help. --- Success, Damir
-
6 มีนาคม 2555 14:07It isn't suitable because it doesn't contain how to display. I know only one method DocumentService.ShowResults() and it requires IResultsDocument. But how to get it from WorkItemCollection?
-
6 มีนาคม 2555 14:41
Andrej,
I think that this issue is already covered here:
Let me know if that helped you
Please remember to mark the replies as answers if they help. --- Success, Damir
-
7 มีนาคม 2555 6:15No, it's the same situation. In case of WorkItemStore use he doesn't display query.
-
8 มีนาคม 2555 8:40ผู้ดูแล
Hi Andrej,
Thanks for your post.
Have you check Matt’s answer reply in his post: http://social.msdn.microsoft.com/Forums/en-US/tfsworkitemtracking/thread/9291c0dd-f1e3-48a4-a98c-6194dc0e88e6/.
If his code snippet still not fit your situation, how and where do you want to display your query?
John Qiao [MSFT]
MSDN Community Support | Feedback to us