GetAccessLink - C#

Copy
// DocumentNOW V2 GetAccessLink 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.LinkServiceClient linker = new DocNow.LinkServiceClient("BasicHttpBinding_ILinkService");
DocNow.GetAccessLinkRequest linkrequest = new DocNow.GetAccessLinkRequest();

linkrequest.DocumentId = documentID;            
linkrequest.DocumentAuthToken = authToken;
linkrequest.ContextIdentifier = accountContextID;
// quirk of .net proxy, we are setting this to true to indicate we are NOT passing an envelopeID, but a documentID is present          
linkrequest.DocumentIdSpecified = true;             
// ditto
linkrequest.DocumentAuthTokenSpecified = true;      
// this is expiration we would like to set on the life of this link, NOT the document
linkrequest.LinkExpirationDate = DateTime.Today.AddHours(24);   
linkrequest.LinkExpirationDateSpecified = true;  
linkrequest.DocumentType = DocNow.LinkDocumentType.Completed;

DocNow.GetAccessLinkResult linksresult = linker.GetAccessLink(linkrequest);

if (linksresult.Exceptions != null)
{
    StringBuilder sb = new StringBuilder();
    foreach (DocNow.LinkException exception in linksresult.Exceptions)
    {
        sb.AppendFormat("{0} : {1}{2}", exception.Severity.ToString(), exception.Value, Environment.NewLine);
    }
    Console.WriteLine(sb.ToString());
}
else
{
    Console.WriteLine(linksresult.Link.Url);
}