Cancel - C#
Copy
// DocumentNOW V2 Cancel example
// 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>);
// assuming we set the namespace on the service proxy to DocNow ...
DocNow.CancelServiceClient client = new DocNow.CancelServiceClient();
DocNow.DocumentCancellation cancellation = new DocNow.DocumentCancellation();
cancellation.Id = documentID;
cancellation.AuthToken = authToken;
cancellation.ContextIdentifier = accountContextID;
cancellation.Remarks = "Revised terms : requires new contract";
DocNow.DocumentCancellationResult[] cancelresults = client.Cancel(new DocNow.DocumentCancellation[] { cancellation });
if (cancelresults.Length > 0)
{
if (cancelresults[0].Exceptions != null)
{
StringBuilder sb = new StringBuilder();
foreach (DocNow.CancellationException exception in cancelresults[0].Exceptions)
{
sb.AppendFormat("{0} : {1}{2}", exception.Severity.ToString(), exception.Value, Environment.NewLine);
}
Console.WriteLine(sb.ToString());
}
else
{
Console.WriteLine(cancelresults[0].Success);
}
}