none
How to get WIs from query and display them?

    Dotaz

  • 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. března 2012 10:32

Všechny reakce