Connect to TFS 2010 using object model
-
Monday, May 09, 2011 6:17 PM
Hi all,
I'm trying to connect to tfs 2010 server using code below but got an exception "The request failed with HTTP status 400: Bad Request.". Am I missing something, please advise.
/// <summary> /// Connects to Team Foundation Server. /// </summary> public bool Connect() { _server = new TfsTeamProjectCollection(new Uri(ServerURL), new UICredentialsProvider()); _versionControl = (VersionControlServer)_server.GetService(typeof(VersionControlServer)); try { _server.EnsureAuthenticated(); return true; } catch { return false; } }
Best Regards, Andy Pham
All Replies
-
Monday, May 09, 2011 10:12 PM
What Url are you connecting with it shuld be in the follwoing format http://Server:8080/tfs/CollectionName
If you simply want to connect as the current user, you dont need an UICredentialProvider.
- Marked As Answer by AndyPham Thursday, May 12, 2011 5:11 PM
-
Thursday, May 12, 2011 5:10 PMThanks... it's url format found issue. I was passing http://server/tfs:8080 instead of http://server:8080/tfs.
Best Regards, Andy Pham

