Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Connecting to TFSPreview Programmatically

I'm attempting to connect to TFS Preview from a C# application.

At the moment, I'm stuck trying to authenticate. I've added a reference to the TFS 2010 DLLs (I believe that these will enable me to connect, please correct me if I am wrong!) and my test case is as simple as. The URL I am trying to connect to is in the form https://MYSERVERNAME.tfspreview.com/DefaultCollection

var teamProjectCollection = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(workPath, new UICredentialsProvider());
teamProjectCollection.EnsureAuthenticated();

This fails with the following exception.

Team Foundation services are not available from server https://MYSERVER.tfspreview.com/$/defaultcollection. Technical information (for administrator): TF400813: Resource not available for anonymous access. Client authentication required.

I had hoped that providing a UICredentialsProvider in the factory method creating the team project collection that it'd use this to provide authentication. The TFS Preview service uses Windows Live authentication, but I had hoped that this would be covered.

Pointers in the right direction greatly appreciated!

like image 727
Jeff Foster Avatar asked Nov 04 '22 19:11

Jeff Foster


1 Answers

I have found that you cannot connect to TFSPreview using the TFS2010 DLL's, most likely because of the web credentials that need to be provided in order to access the site.

By adding a reference to the TFS2012 DLLs (which come with the Visual Studio 2012 RC at %PROGRAMFILESX86\Microsoft Visual Studio 11.0\Common7\IDE\ReferenceAssemblies\v2.0) I was able to successfully connect.

like image 81
Jeff Foster Avatar answered Nov 16 '22 07:11

Jeff Foster