I need to get a list of process templates in TFS in order to further create my own process templates. How to get this interface?

IProcessTemplate processTemplate; 
  • one
    Corrected the issue - ivan pupkin

1 answer 1

I always use the client to work items to get the service:

 WorkItemStore _wistore = new WorkItemStore("http://server_name:8080/tfs/DefaultCollection"); IProcessTemplates _templates = _wistore.TeamProjectCollection.GetService<IProcessTemplates>(); foreach (TemplateHeader _tmpl in _templates.TemplateHeaders()) Console.WriteLine("Process template: ID - {0}; Name - {1}; State - {2}\n{3}", _tmpl.TemplateId, _tmpl.Name, _tmpl.State, _tmpl.Description); 

There is a list of service functions: https://loicbaumann.fr/en/2009/04/02/what-you-need-to-know-to-use-the-process-template-api/

  • Thank you, I have another question: "Can I get a template to change its elements, etc., to fit my needs?" - ivan pupkin
  • Through the code, I did not do this. But I think (based on the link) that you can get the process GetTemplateData and then unpack the zip. Next, you need to fix the xml workflow in the "WorkItem Tracking \ TypeDefinitions" folder of the On-premises XML process model . Then pack and send it back via AddUpdateTemplate. - Shamrai Aleksander