Click here to Skip to main content
15,896,557 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello,

i have a problem with my code when i run it returns all the list of projects available on the entered URI

but i need to return a list of projects for a specific developer

my code:

public List<string> ListAllProjects()
{
    TeamFoundationServer teamFoundationServer =
     TeamFoundationServerFactory.GetServer(@"http:\\ld-tfs08sp1:8080\\");
    teamFoundationServer.Authenticate();



    WorkItemStore workItemStore = new WorkItemStore(@"http:\\ld-tfs08sp1:8080\\");
    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;
}





please any one can help mee
Posted

When you authenticate to the server and execute a fetch to retrieve the WorkItems the server only make available those that the logged user have access.
Maybe you are testing with a user that have access to all projects.
Try to create a user with limited access and run your application with this logon.
 
Share this answer
 
Try this...

Uri tfsUri = new Uri("http:\\ld-tfs08sp1:8080\\CollectionName\\ProjectName");
TeamFoundationServer oTFS = new TeamFoundationServer(tfsUri, new NetworkCredential("username", "password", "domainname"));
oTFS.EnsureAuthenticated();

Regards
Balaji Ganesan
 
Share this answer
 
v4

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