Follow

CheckEnvelopeStatus - C#

Last updated 2017-08-15 19:20:52 UTC

The best performing means of getting document or envelope status is to use DocumentTRAK to push notifications to your self hosted service.

// DocumentNOW V2 CheckEnvelopeStatus 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.CheckEnvelopeStatusRequest request = new DocNow.CheckEnvelopeStatusRequest();
request.ContextIdentifier = accountContextID;
request.EnvelopeId = envelopeId;
request.AuthToken = authToken;

DocNow.CheckEnvelopeStatusResult result = client.CheckEnvelopeStatus(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 CheckEnvelopeStatus:{sb.ToString()}");
}
else
{
    Console.WriteLine($"{result.Status}");
    // envelope history
    foreach (DocNow.EnvelopeHistoryEvent evt in result.History)
    {
        Console.WriteLine($"{evt.Date} : {evt.Details}");
    }
    foreach (DocNow.EnvelopeDocument document in result.Documents)
    {
        Console.WriteLine($"{document.DocumentId}");
        Console.WriteLine($"{document.Name}");
        Console.WriteLine($"{document.Status}");
        // each document's history
        foreach (DocNow.EnvelopeDocumentHistoryEvent evt in document.History)
        {
            Console.WriteLine($"{evt.Date} : {evt.Details}");
        }
    }
}
Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

0 Comments

Article is closed for comments.