Click here to Skip to main content
15,901,205 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi
i have a <list> as projectcollects


XML
public   List<string> ListAllProjects
        {
            TeamFoundationServer tfs = TeamFoundationServerFactory.GetServer(@"http://servername/");
            tfs.EnsureAuthenticate();
            WorkItemStore workItemStore = new WorkItemStore(@"http://servername/tfs/POC");
            List<string> list = new List<string>();
            foreach (Project pr in workItemStore.Projects)
            {
                list.Add(pr.Name);
            }
            if (list.Count == 0)
                list.Add("Not Found");
            return list;
        }


now i want to select ListAllProjects.item=="projectname1" in that list.
this program captures all projects from TFS server.
note: here servername illustrate the TFS server name

pls help to me

thanks ®ards
nareshrajuu
Posted

Hi,

just go through your list and compare it with "projectname1":

C#
foreach(string item in ListAllProjects)
{
  if(item == "projectname1")
  {
     //do what you want to do
  }
}

With Best Regards
 
Share this answer
 
v2
thanks a lot to your replay.

i written like this

C#
public   List<string> ListAllProjects
        {
            TeamFoundationServer teamFoundationServer = TeamFoundationServerFactory.GetServer(@"http://tfsservername/");
            teamFoundationServer.Authenticate();
            WorkItemStore workItemStore = new WorkItemStore(@"http://tfsservername");
            List<string> list = new List<string>();
            foreach (Project pr in workItemStore.Projects)
            {
                list.Add(pr.Name);
            }
            if (list.Count == 0)
                list.Add("Not Found");
         else
      {
         foreach(string item in ListAllProjects)
                 { 
               if(item == "projectname1")
                     {
                    return item;
                      }
                  }
     } 

but not getting that particular projectname1.
please help to me how can i will write.is there anotherway?
 
Share this answer
 
v2
Comments
El_Codero 4-Apr-12 5:34am    
Sorry, but that should be easy to achieve. I guess something is wrong with connection or Project "Name" Property (wrong name "projectname1") when receiving projects from Microsoft's TeamFoundation Server. Please make sure connection gets successfully established and do a quick test by receiving and displaying Project Names in MessageBox.Show() or console.
hi Bjorn Ranft,

thank for your suggestion, it was working.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900