Connect to TFSPreview Programmatically

I am trying to connect to TFS Preview from a C # application.

I'm currently stuck trying to authenticate. I added a link to the TFS 2010 DLL (I believe this will allow me to connect, please correct me if I am wrong!), And my test case is simple. The URL I'm trying to connect to is in the formhttps://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 the server https://MYSERVER.tfspreview.com/ $ / defaultcollection. Technical Information (for Administrator): TF400813: The resource is not available for anonymous access. Client authentication required.

I was hoping that with the help of UICredentialsProviderthe factory, a project project team would be created that would be used to provide authentication. The TFS Preview service uses Windows Live authentication, but I was hoping this would be covered.

Pointers in the right direction are highly appreciated!

+5
source share
2 answers

I found that you cannot connect to TFSPreview using the TFS2010 DLL, most likely due to the web credentials that must be provided to access the site.

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

+2
source

All Articles