Pages

Friday, November 28, 2014

How to identify the TFS process template programmatically?

TfsClientCredentials crd = new TfsClientCredentials(true);
                        Uri uri = new Uri(this.Context.ConnectionString);

                        TfsTeamProjectCollection tfs = new TfsTeamProjectCollection(uri, crd);

                        ICommonStructureService css = (ICommonStructureService)tfs.GetService(typeof(ICommonStructureService));

                        ProjectInfo projectInfo = css.GetProjectFromName(this.Context.CommandParameters["ProjectName"].ToString());
                            String projectName;
                            String prjState;
                            int templateId = 0;
                            ProjectProperty[] projectProperties;


                            css.GetProjectProperties(
                                projectInfo.Uri, out projectName, out prjState, out templateId, out projectProperties);

Console.WriteLine(projectProperties[2].Value); //This will give you process template name


Refrence: Link

No comments:

Post a Comment