I actually used the following code:
static void GetProjectTemplate()
{
string collectionName = "http://<our_host_name>:8080/tfs/defaultcollection/";
TfsTeamProjectCollection tfs = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri(collectionName)
, new UICredentialsProvider());
tfs.EnsureAuthenticated();
ICommonStructureService css = (ICommonStructureService)tfs.GetService(typeof(ICommonStructureService));
string[] projects = { "proj1", "proj2", "proj3" };
foreach (string proj in projects)
{
ProjectInfo projectInfo = css.GetProjectFromName(proj);
String projectName;
String prjState;
int templateId = 0;
ProjectProperty[] projectProperties;
css.GetProjectProperties(
projectInfo.Uri, out projectName, out prjState, out templateId, out projectProperties);
Console.WriteLine(templateId);
}
// Locate templateId in the list of Process templates
IProcessTemplates processTemplates = (IProcessTemplates)tfs.GetService(typeof(IProcessTemplates));
XmlNode node = processTemplates.GetTemplateNames();
Console.WriteLine(Regex.Replace( node.InnerXml,"<[A-Za-z]","\n$&", RegexOptions.ECMAScript ) );
}
...copied and modified from here: http://www.databaseforum.info/30/1083827.aspx
Problem is, I still get '-1' as the template id. Does this mean the projects were created with no template? Also, I changed the project and host names above for posting here. (They are legitimate projects).