ListEnvelopeTemplates - C#

Copy
// DocumentNOW V2 ListEnvelopeTemplates 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.EnvelopeServiceClient client = new DocNow.EnvelopeServiceClient("BasicHttpBinding_IEnvelopeService1");
DocNow.ListEnvelopeTemplatesRequest query = new DocNow.ListEnvelopeTemplatesRequest();
query.ContextIdentifier = accountContextID;
query.UserName = "yourusername@yourdomain.com";

DocNow.ListEnvelopeTemplatesResult result = client.ListEnvelopeTemplates(query);

if(result.Exceptions != null)
{
    StringBuilder sb = new StringBuilder();
    foreach (DocNow.EnvelopeException exception in result.Exceptions)
    {
        sb.AppendFormat("{0}{1} : {2}", Environment.NewLine, exception.Severity.ToString(), exception.Value);
    }
    throw new Exception($"Errors occurred calling ListEnvelopeTemplates:{sb.ToString()}");
}
else
{
    foreach (DocNow.EnvelopeTemplate template in result.Templates)
    {
        Console.WriteLine($"{template.Name} ({template.EnvelopeTemplateId}): modified {template.ModifiedDate}: tag {template.Tag} : description {template.Description}");
    }
}