Skip to main content
Nintex Community Menu Bar

DownloadEnvelopeDocuments - C#

  • January 11, 2022
  • 0 replies
  • 9 views
  • Translate

butlerj
Nintex Employee
Forum|alt.badge.img+20
// DocumentNOW V2 DownloadEnvelopeDocuments 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.DownloadEnvelopeDocumentsRequest request = new DocNow.DownloadEnvelopeDocumentsRequest(); request.ContextIdentifier = accountContextID; request.EnvelopeId = envelopeId; request.AuthToken = authToken;  DocNow.DownloadEnvelopeDocumentsResult result = client.DownloadEnvelopeDocuments(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 DownloadEnvelopeDocuments:{sb.ToString()}"); } else {     // if we had set: request.MergeCompletedDocuments = true;     // then we would check result.MergedDocument     foreach(DocNow.EnvelopeDocument document in result.Documents)     {         Console.WriteLine($"{document.DocumentId}");         Console.WriteLine($"{document.Name}");          if(document.CompletedDocument != null)         {             byte[] filecontents = document.CompletedDocument.Data;             File.WriteAllBytes($"c:\temp\{document.DocumentId}.pdf", filecontents);         }     } } 

For .NET clients, you may initially receive an error when downloading a file with the following or similar message:

The maximum message size quota for incoming messages (65536) has been exceeded. To increase the quota, use the MaxReceivedMessageSize property on the appropriate binding element

To make this change, modify the following bindings to set an increased max message size, such as

 <binding name="BasicHttpBinding_IEnvelopeService" messageEncoding="Mtom" maxReceivedMessageSize="2000000" maxBufferSize="2000000">     <security mode="Transport" /> </binding> <binding name="BasicHttpBinding_IEnvelopeService1" maxReceivedMessageSize="2000000" maxBufferSize="2000000">     <security mode="Transport" /> </binding>
Did this topic help you find an answer to your question?

0 replies

Be the first to reply!

Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie Settings