How can I pull artifacts from TeamCity?

I would like to pull artifacts from teamcity.

I am trying to use C # and HtmlAgilityPack to go to a site and find the latest version and its artifacts. I am currently focused on login, I think I just need to send Session Cookies.

I'm going in the right direction, has anyone else tried this?

I understand that pushing files using build scripts is easy, but I would like to minimize the changes in Ant, NAnt files, as I am looking to scale up to 100 applications.

Edit: this question looks promising Getting an HTML page for a subscription

Edit: now it works, I just need to write code to analyze it

WebClient ww = new WebClient();
ww.Credentials = CredentialCache.DefaultCredentials;
ww.DownloadString("http://yourteamcity.com/login.html");
ww.Headers.Add("Cookie",ww.ResponseHeaders["Set-Cookie"]);

NameValueCollection post = new NameValueCollection();
post.Add("username", "name");
post.Add("remember","true");
post.Add("submitLogin", "Login");
post.Add("publicKey","long thing to intercept with fiddler");
post.Add("encryptedPassword","not giving you this");
post.Add("_", "");
byte[] values = ww.UploadValues("http://yourteamcity.com/loginSubmit.html", "POST",post);
string s = ww.DownloadString("http://yourteamcity.com/overview.html");
+5

All Articles