CreateEnvelope - C#

  • 11 January 2022
  • 0 replies
  • 16 views

Userlevel 5
Badge +19
// DocumentNOW V2 CreateEnvelope example  // force TLS 1.2 if .net < 4.6 ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12; 	 Guid accountContextID = new Guid(<fromYourAccount>); Guid envelopeTemplateId = new Guid(<fromYourAccount>);  // assuming we set the namespace on the service proxy to DocNow ... DocNow.EnvelopeServiceClient client = new DocNow.EnvelopeServiceClient("BasicHttpBinding_IEnvelopeService1"); DocNow.CreateEnvelopeRequest request = new DocNow.CreateEnvelopeRequest();  request.ContextIdentifier = accountContextID; request.EnvelopeTemplateId = envelopeTemplateId; request.EnvelopeName = DateTime.Now.ToString("s"); // if a signer declines, the entire envelope is declined request.DeclineBehavior = DocNow.EnvelopeDeclineBehaviorType.DeclineAll; // signers will all be able to sign immediately request.WorkflowType = DocNow.EnvelopeWorkflowType.Parallel;  DocNow.CreateEnvelopeResult result = client.CreateEnvelope(request);  if (result[0].Exceptions != null) {     StringBuilder sb = new StringBuilder();     foreach (DocNow.EnvelopeException exception in cancelresults[0].Exceptions)     {         sb.AppendFormat("{0} : {1}{2}", exception.Severity.ToString(), exception.Value, Environment.NewLine);     }     Console.WriteLine(sb.ToString()); } else {     // we will need these for submissions of documents, and other envelope operations     Console.WriteLine(result.EnvelopeId);     Console.WriteLine(result.AuthToken);     Guid envelopeID = result.EnvelopeId;     Guid authToken = result.AuthToken;       // perform 1 or more document Submit or SubmitWithFile calls here, setting the envelopeID on the metadata     // such as "doc.Metadata.EnvelopeId = envelopeID;"     // then call CloseEnvelope  }

0 replies

Be the first to reply!

Reply