none
Connect to TFS 2010 using object model

    Question

  • 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
    Monday, May 09, 2011 6:17 PM

Answers

  • 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
    Monday, May 09, 2011 10:12 PM

All replies