Connecting to Team Foundation Server programmatically isn't as obvious as you might expect. Here's a topic that describes how to do that that. It'll be included in the TFS SDK when we publish that. Let me know whether this info is helpful, and what else you'd like to see.
My next post will cover doing some things with work item tracking. Hin