ViewHistory - C#
Copy
// DocumentNOW V2 ViewHistory 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.ViewHistoryServiceClient client = new DocNow.ViewHistoryServiceClient();
DocNow.DocumentHistoryView request = new DocNow.DocumentHistoryView();
request.Id = documentID;
request.AuthToken = authToken;
request.ContextIdentifier = accountContextID;
DocNow.DocumentHistoryViewResult[] historyresults = client.ViewHistory(new DocNow.DocumentHistoryView[] { request });
if (historyresults.Length > 0)
{
if (historyresults[0].Exceptions != null)
{
StringBuilder sb = new StringBuilder();
foreach (DocNow.HistoryViewException exception in historyresults[0].Exceptions)
{
sb.AppendFormat("{0} : {1}{2}", exception.Severity.ToString(), exception.Value, Environment.NewLine);
}
Console.WriteLine(sb.ToString());
}
else
{
foreach(DocNow.DocumentEvent docevent in historyresults[0].Events)
{
Console.WriteLine($"{docevent.Date.ToString()} : {docevent.Details}");
}
}
}