ListTemplates - C#
Copy
// DocumentNOW V2 ListTemplates example
// assuming we set the namespace on the service proxy to DocNow ...
// force TLS 1.2 if .net < 4.6
ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12;
Guid accountContextID = new Guid(<fromYourAccount>);
DocNow.ListTemplatesServiceClient client = new DocNow.ListTemplatesServiceClient();
DocNow.TemplateListQuery query = new DocNow.TemplateListQuery();
query.ContextIdentifier = accountContextID;
query.UserName = "yourusername@yourdomain.com";
DocNow.TemplateListQueryResult result = client.ListTemplates(query);
if(result.Exceptions != null)
{
StringBuilder sb = new StringBuilder();
foreach (DocNow.TemplateListException exception in result.Exceptions)
{
sb.AppendFormat("{0}{1} : {2}", Environment.NewLine, exception.Severity.ToString(), exception.Value);
}
throw new Exception($"Errors occurred calling ListTemplates:{sb.ToString()}");
}
else
{
foreach (DocNow.TemplateItem template in result.Templates)
{
Console.WriteLine($"{template.Name} ({template.Id}): modified {template.ModifiedDate}: accessibility {template.Accessibility} : description {template.Description}");
}
}