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);