ListParameters - C#

Copy
// DocumentNOW V2 ListParameters 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>);
Guid templateId = new Guid(<fromYourAccount>);

DocNow.ListParametersServiceClient client = new DocNow.ListParametersServiceClient();
DocNow.ParameterListQuery query = new DocNow.ParameterListQuery();
query.ContextIdentifier = accountContextID;
query.TemplateId = templateId;
query.UserName = "yourusername@yourdomain.com";

DocNow.ParameterListQueryResult result = client.ListParameters(query);

if(result.Exceptions != null)
{
    StringBuilder sb = new StringBuilder();
    foreach (AssureSign.ParameterListException exception in result.Exceptions)
    {
        sb.AppendFormat("{0}{1} : {2}", Environment.NewLine, exception.Severity.ToString(), exception.Value);
    }
    throw new Exception($"Errors occurred calling ListTemplateParameters:{sb.ToString()}");
}
else
{
    foreach (DocNow.TypedParameterItem item in result.Parameters)
    {
        Console.WriteLine($"{item.Name} : {item.Prompt} : {item.Required} : {item.Tag} : {item.Regex} : {item.ValidationMessage}");
    }
}