TFS Server Credential Error

时间:2016-05-17 11:14:29

标签: c# tfs

I want to collect a List of Project in TFS 2013 Using API .

I am Putting URL and User name and Password, (Server properly Connected Browser).

I have collected all Project with TFS Collection List. But my API Call does not working on client. What is the problem?

Here My Sample Code

Uri configurationServerUri = new Uri(URL);
NetworkCredential credentials = new NetworkCredential(UserName, Password);
teamProjectCollection = new TfsTeamProjectCollection(configurationServerUri, credentials);// Set Connection 
teamProjectCollection.EnsureAuthenticated();

//CatalogNode configurationServerNode = teamProjectCollection.TeamFoundationServer.TfsTeamProjectCollection.CatalogNode;

//li.Add(configurationServerNode.Resource.DisplayName);


TfsConfigurationServer configurationServer = TfsConfigurationServerFactory.GetConfigurationServer(configurationServerUri);
ITeamProjectCollectionService tpcService = configurationServer.GetService<ITeamProjectCollectionService>();
foreach (TeamProjectCollection tpc in tpcService.GetCollections())
{
    list.Add(tpc.Name);
} 

0 个答案:

没有答案