/// <summary> /// Retrieve a Template record with the name "Title" /// </summary> /// <param name="service">The organization service</param> /// <param name="tracingService">The tracing service</param> /// <param name="templateName">The name of the template to retrieve</param> /// <param name="ignoreCache">A value indicating whether to ignore cache</param> /// <returns>Template Entity</returns> public static Template GetTemplate(IOrganizationService service, ITracingService tracingService, string templateName, bool ignoreCache = false) { lock (LockTemplateCache) { GetTemplates(service, tracingService, ignoreCache); var templates = TemplateCache.Where(t => t.Value.Title == templateName); switch (templates.Count()) { case 1: return(templates.First().Value); default: return(null); } } }