locked
TFS 2010: Programmatically get a Work Item list of a query RRS feed

  • Question

  • Hi,

    I want to write a simple application for getting a list of work items for a query defined in TFS 2010.

    Can you please show me a short code snippet to connect to a stored query in TFS and get the IDs of all work Items of the query resulti

    Wednesday, July 3, 2013 7:27 PM

Answers

  • Hi,

    Thanks for your post!

    You can refer to the codes snippet in this article: http://pwee167.wordpress.com/2012/09/18/retrieving-work-items-using-the-team-foundation-server-api/.

               TfsTeamProjectCollection tfs = new TfsTeamProjectCollection(new Uri("UrI"));
                tfs.EnsureAuthenticated();

                WorkItemStore workitemstore = tfs.GetService<WorkItemStore>();
                string wiql ="SELECT * FROM WorkItems WHERE [System.TeamProject] = 'TeamProject' ORDER BY [System.Id] ";
                WorkItemCollection wic = workitemstore.Query(wiql);
                foreach(WorkItem wi in wic)
                {

                            … … …

                 }
     

    Best Regards,


    Cathy Kong
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.


    Thursday, July 4, 2013 8:16 AM
    Moderator