Larry Wall, the creator of the infamous Perl programming language, has once said that the greatest virtues of a good programmer are Laziness, Impatience and Hubris. To not mislead the lazy “computer science” students, allow me to define each virtues:
- Laziness — The quality that makes you go to great effort to reduce overall energy expenditure. It makes you write labor-saving programs that other people will find useful, and document what you wrote so you don’t have to answer so many questions about it. Hence, the first great virtue of a programmer. See also impatience and hubris.
- Impatience – The anger you feel when the computer is being lazy. This makes you write programs that don’t just react to your needs, but actually anticipate them. Or at least pretend to. Hence, the second great virtue of a programmer. See also laziness and hubris.
- Hubris – Excessive pride. Also the quality that makes you write (and maintain) programs that other people won’t want to say bad things about. Hence, the third great virtue of a programmer. See also laziness and impatience.
A few days ago, a tester at our company filled a track that contained multiple attachments (Screenshots, Error Logs, etc) to assist the developers on their investigation. As we are using Microsoft’s Team Foundation System for source control and bug tracking, the most obvious way to get these attachments is through TFS Web Access; Frankly speaking, this is the only “official” way to access the track (bug report) on our company.
I don’t know if its a lack of feature or what, but there is no way in TFS Web Access to download multiple attachments at once. Additionally, when downloading attachments that contains a space on their filename, TFS Web Access will automatically concatenate the filename and that will remove the file’s extension (EG: Screenshot of the bug.jpg will be renamed to Screenshot)… You still need to manually rename the file with the proper extension to open it. And because I’m lazy, I don’t want to log-in to TFS Web Access, type in the track ID, click on the attachments tab, click on the file(s) I want to download, browse for the location where to save the file, create a new folder for the track, click save, minimize my browser, open the download location and (unzip the attachment, it its zipped, which normally is) to just view a single screenshot.
Since I am a big believer of Wall’s three virtues, I created a tool that will automate those boring and repetitive tasks for me (and allow me to download *all* attachments from a work item + workaround the “spacing” bug). The tool is called WIF or Work Item Fetcher and it is currently in Closed-Limited Beta.
At first, I thought about parsing the web pages to download the attachments using HTML Sanitizers and Regular Expressions but then I remembered that only Chuck Norris can parse HTML using regular expressions! So I searched the web and found out about the TFS SDK! Go .NET! Go Laziness! Okay, enough chit-chat, the rest of the post will be dedicated to discussing how to use the TFS API to download attachments from TFS.




(4 votes, average: 4.00 out of 5)




























































Comments