How to convert TFS folder to branch programmatically by TFS API (Convert to Branch operation in VS2010))
First you need create instance of VersionControlServer object. Then use CreateBranchObject method. serverTrunkPath="C:\myWorkspace\trunk" - target folder you want to make branch.
versionControlServer.CreateBranchObject(new BranchProperties(new ItemIdentifier(serverTrunkPath)));