Tim Huffam

Dotting the I and crossing the T of I.T.

  Home  |   Contact  |   Syndication    |   Login
  153 Posts | 0 Stories | 2747 Comments | 653 Trackbacks

News

Archives

Post Categories

Interesting Blogs/Links

When creating a branch programmatically using the TFS 2010 API, if you do not do things in the correct sequence, TFS does not create the proper object types and/or relationships eg either the folders will not show as branches (showing the branch icon instead of the folder icon) in Source Control Explorer or they will show as branches, but when you do View Hierarchy, it will not show the relationships/structure.

After much trial an error I have found the solution...

(assuming the source folder already exists)

// The source of the branch must first be created as a branch object
VersionControl.CreateBranchObject(new BranchProperties(new ItemIdentifier(sourceServerPath)));

// Then you can create the branch
VersionControl.CreateBranch(sourceServerPath, targetServerPath, VersionSpec.Latest, null, checkinComment, null, null, null);

That's it!

HTH
Tim

posted on Thursday, April 19, 2012 10:40 PM

Feedback

# re: Programmatically create a branch with the TFS 2010 API 10/24/2012 12:40 AM visit this site
It has been really nice reading about programmatically creating a branch. Thanks for sharing.

# re: Programmatically create a branch with the TFS 2010 API 11/20/2012 2:18 AM tai facebook
a few of code, you save my life

# re: Programmatically create a branch with the TFS 2010 API 11/21/2012 2:44 AM mazapoint
programming is not a easy thing to do there are many thing include in it like there various types of coding as well as some script and many more things

# re: Programmatically create a branch with the TFS 2010 API 11/23/2012 4:17 AM tai opera mini
I love this site, thanks bro

# re: Programmatically create a branch with the TFS 2010 API 4/14/2013 2:01 PM Maria
Thanks I will check this out. I just started studying IT, so this will be useful.

# re: Programmatically create a branch with the TFS 2010 API 4/29/2013 8:35 AM Sarah
Das hat gut bei mir funktioniert, vielen Dank für den Code - thanks for your great help.

Post A Comment
Title:
Name:
Email:
Comment:
Verification: