ListEnvelopeDocuments - C#

Copy

// DocumentNOW V2 ListEnvelopeDocuments 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 envelopeId = new Guid(<fromSubmission>);
Guid authToken = new Guid(<fromSubmission>);

DocNow.EnvelopeServiceClient client = new DocNow.EnvelopeServiceClient("BasicHttpBinding_IEnvelopeService1");
DocNow.ListEnvelopeDocumentsRequest request = new DocNow.ListEnvelopeDocumentsRequest();
request.ContextIdentifier = accountContextID;
request.EnvelopeId = envelopeId;
request.AuthToken = authToken;

DocNow.ListEnvelopeDocumentsResult result = client.ListEnvelopeDocuments(request);


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 ListEnvelopeDocuments:{sb.ToString()}");
}
else
{
    foreach(DocNow.EnvelopeDocument document in result.Documents)
    {
        Console.WriteLine($"{document.DocumentId}");
        Console.WriteLine($"{document.AuthToken}");
        Console.WriteLine($"{document.Name}");
        Console.WriteLine($"{document.OrderId}");
    }
}