Skip to main content
Nintex Community Menu Bar
// DocumentNOW V2 Download 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 documentID = new Guid(<savedFromYourSubmission>);
Guid authToken = new Guid(<savedFromYourSubmission>);
byte[] filecontents;

// there are multiple bindings
DocNow.DownloadServiceClient download = new DocNow.DownloadServiceClient("BasicHttpBinding_IDownloadService");
DocNow.DownloadRequest request = new DocNow.DownloadRequest();
request.DocumentId = documentID; // the documentID you stored after the submission
request.AuthToken = authToken; // the authToken you stored after the submission
request.ContextIdentifier = accountContextID;

// to get the completed, signed document
request.DownloadType = DocNow.DownloadType.Completed;

DocNow.DownloadResult result = download.Download(request);

if(result.Exceptions != null)
{
StringBuilder sb = new StringBuilder();
foreach (DocNow.DownloadException exception in result.Exceptions)
{
sb.AppendFormat("{0}{1} : {2}", Environment.NewLine, exception.Severity.ToString(), exception.Value);
}
throw new Exception($"Errors occurred downloading document:{sb.ToString()}");
}
else
{
// here is the file
filecontents = result.FileData;
}

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_IDownloadService" messageEncoding="Mtom" maxReceivedMessageSize="2000000" maxBufferSize="2000000">
<security mode="Transport" />
</binding>
<binding name="BasicHttpBinding_IDownloadService1" maxReceivedMessageSize="2000000" maxBufferSize="2000000">
<security mode="Transport" />
</binding>
Be the first to reply!

Reply