DocuSign using Chilkat dll, how do I pass templateRoles in json? - vb.net

I am creating demo application which Docusing pass file and signer dynamically, for that i need to use docusign templateid and pass details, i can pass file using templateid which signer already defined in template itself, now i want to pass multiple signer as dynamically.For that need to use templateRoles.
Dim json As New Chilkat.JsonObject
json.UpdateString("documents[0].name", "Testing.pdf")
json.UpdateString("documents[0].documentBase64", base64String)
json.UpdateString("documents[0].documentId", "2")
json.UpdateString("emailSubject", "DocuSign REST API Testing Sample")
json.UpdateString("emailBlurb", "Create and send an envelope from a document.")
json.UpdateString("templateId", "xxxxx-xxxxx-xxxxx-xxxx-xxxx")
json.UpdateString("templateRoles", "{roleName: Signer 1, name: Aravind, email: aravind#gmail.com, recipientId: 1}") ' Here i pass template role for signer 1, and also need to pass multiple signer.
json.UpdateString("status", "sent")
rest.AddHeader("X-DocuSign-Authentication", "{ ""Username"": ""DocuSign#example.com"", ""Password"":""DocuSign_password"", ""IntegratorKey"":""DocuSign_Integrator_Key"" }")
rest.AddHeader("Content-Type", "application/json")
rest.AddHeader("Accept", "application/json")
Dim sbRequestBody As New Chilkat.StringBuilder
json.EmitSb(sbRequestBody)
Dim sbResponseBody As New Chilkat.StringBuilder
success = rest.FullRequestSb("POST", "/restapi/v2.1/accounts/xxxxxx/envelopes", sbRequestBody, sbResponseBody)
Dim respStatusCode As Integer = rest.ResponseStatusCode
Here i paste code for ur reference, in that email,password,key everything i chanage,bcz it releted to security purpose.
When i pass templateroles with values i get error.For above code i get following error return from api.
"errorCode":"INVALID_REQUEST_PARAMETER","message":"The request
contained at least one invalid parameter. 'recipientId' not set for
recipient."
Pls help me to solve this error.
Regards,
Aravind

Here is code using the SDK:
Imports System
Imports System.Collections.Generic
Imports DocuSign.eSign.Api
Imports DocuSign.eSign.Client
Imports DocuSign.eSign.Model
Imports Microsoft.AspNetCore.Mvc
Private Function DoWork(ByVal signerEmail As String, ByVal signerName As String, ByVal ccEmail As String, ByVal ccName As String, ByVal accessToken As String, ByVal basePath As String, ByVal accountId As String, ByVal templateId As String) As String
Dim config = New Configuration(New ApiClient(basePath))
config.AddDefaultHeader("Authorization", "Bearer " & accessToken)
Dim envelopesApi As EnvelopesApi = New EnvelopesApi(config)
Dim envelope As EnvelopeDefinition = MakeEnvelope(signerEmail, signerName, ccEmail, ccName, templateId)
Dim result As EnvelopeSummary = envelopesApi.CreateEnvelope(accountId, envelope)
Return result.EnvelopeId
End Function
Private Function MakeEnvelope(ByVal signerEmail As String, ByVal signerName As String) As EnvelopeDefinition
Dim buffer As Byte() = System.IO.File.ReadAllBytes(Config.docPdf)
Dim envelopeDefinition As EnvelopeDefinition = New EnvelopeDefinition()
envelopeDefinition.EmailSubject = "Please sign this document"
Dim doc1 As Document = New Document()
Dim doc1b64 As String = Convert.ToBase64String(buffer)
doc1.DocumentBase64 = doc1b64
doc1.Name = "Lorem Ipsum"
doc1.FileExtension = "pdf"
doc1.DocumentId = "3"
envelopeDefinition.Documents = New List(Of Document) From {
doc1
}
Dim signer1 As Signer = New Signer With {
.Email = signerEmail,
.Name = signerName,
.ClientUserId = signerClientId,
.RecipientId = "1"
}
Dim signHere1 As SignHere = New SignHere With {
.AnchorString = "/sn1/",
.AnchorUnits = "pixels",
.AnchorXOffset = "10",
.AnchorYOffset = "20"
}
Dim signer1Tabs As Tabs = New Tabs With {
.SignHereTabs = New List(Of SignHere) From {
signHere1
}
}
signer1.Tabs = signer1Tabs
Dim recipients As Recipients = New Recipients With {
.Signers = New List(Of Signer) From {
signer1
}
}
envelopeDefinition.Recipients = recipients
envelopeDefinition.Status = "sent"
Return envelopeDefinition
End Function

Try to remove recipientId: 1 from the JSON in line 8.
But I strongly suggest you reconsider your architecture choices.
You are using legacy authentication which is not very secure.
You could use the C# SDK, which is a Nuget package and works just as well with VB.NET and that would help you make these calls without using JSON and also using modern OAuth that is much more secure.

Related

How to pass phone verification in DocuSign?

Here i use DocuSign SDK code for send envelope, so in this how to pass phone verification ?
In this code I pass signer and signing location with the help of co-ordinates and send to envelope. I get access token without fail.
Private Function DoWork(ByVal signerEmail As String, ByVal signerName As String, ByVal ccEmail As String, ByVal ccName As String, ByVal accessToken As String, ByVal basePath As String, ByVal accountId As String, ByVal templateId As String) As String
Dim config = New Configuration(New ApiClient(basePath))
config.AddDefaultHeader("Authorization", "Bearer " & accessToken)
Dim envelopesApi As EnvelopesApi = New EnvelopesApi(config)
Dim envelope As EnvelopeDefinition = MakeEnvelope(signerEmail, signerName, ccEmail, ccName, templateId)
Dim result As EnvelopeSummary = envelopesApi.CreateEnvelope(accountId, envelope)
Return result.EnvelopeId
End Function
Private Function MakeEnvelope(ByVal signerEmail As String, ByVal signerName As String) As EnvelopeDefinition
Dim buffer As Byte() = System.IO.File.ReadAllBytes(Config.docPdf)
Dim envelopeDefinition As EnvelopeDefinition = New EnvelopeDefinition()
envelopeDefinition.EmailSubject = "Please sign this document"
Dim doc1 As Document = New Document()
Dim doc1b64 As String = Convert.ToBase64String(buffer)
doc1.DocumentBase64 = doc1b64
doc1.Name = "Lorem Ipsum"
doc1.FileExtension = "pdf"
doc1.DocumentId = "3"
envelopeDefinition.Documents = New List(Of Document) From {
doc1
}
Dim signer1 As Signer = New Signer With {
.Email = signerEmail,
.Name = signerName,
.ClientUserId = signerClientId,
.RecipientId = "1"
}
Dim signHere1 As SignHere = New SignHere With {
.AnchorString = "/sn1/",
.AnchorUnits = "pixels",
.AnchorXOffset = "10",
.AnchorYOffset = "20"
}
Dim signer1Tabs As Tabs = New Tabs With {
.SignHereTabs = New List(Of SignHere) From {
signHere1
}
}
signer1.Tabs = signer1Tabs
Dim recipients As Recipients = New Recipients With {
.Signers = New List(Of Signer) From {
signer1
}
}
envelopeDefinition.Recipients = recipients
envelopeDefinition.Status = "sent"
Return envelopeDefinition
End Function
I want to pass phone number to verify once open document from email. Anybody help in this feature will appreciated.
Thanks and Regards
Aravind
https://developers.docusign.com/docs/esign-rest-api/how-to/phone-auth/
Dim workflow As RecipientIdentityVerification = New RecipientIdentityVerification() With {
.WorkflowId = workflowId,
.InputOptions = New List(Of RecipientIdentityInputOption) From {
New RecipientIdentityInputOption With {
.Name = "phone_number_list",
.ValueType = "PhoneNumberList",
.PhoneNumberList = New List(Of RecipientIdentityPhoneNumber) From {
New RecipientIdentityPhoneNumber With {
.Number = phoneNumber,
.CountryCode = countryAreaCode
}
}
}
}
Since we don't have VB.NET examples, I used this site to convert C# code.
}

How to pass DocuSign email EmailBlurb for each signer?

I have create envelope and pass signer,document, position to sign.So in that i need to pass EmailBlurb for each signer separately.Form Docusing web ui can set using following option and each signer get different message.
So how to pass this message from Docusing code, here the piece of code which i pass 2 signers
Private Function MakeEnvelope(ByVal signerEmail As String, ByVal signerName As String) As EnvelopeDefinition
Dim buffer As Byte() = System.IO.File.ReadAllBytes(Config.docPdf)
Dim envelopeDefinition As EnvelopeDefinition = New EnvelopeDefinition()
envelopeDefinition.EmailSubject = "Please sign this document"
envelopeDefinition.EmailBlurb ="Dear. A Thanks and regards" ' this will appear for both signer
Dim doc1 As Document = New Document()
Dim doc1b64 As String = Convert.ToBase64String(buffer)
doc1.DocumentBase64 = doc1b64
doc1.Name = "Lorem Ipsum"
doc1.FileExtension = "pdf"
doc1.DocumentId = "1"
envelopeDefinition.Documents = New List(Of Document) From {
doc1
}
Dim signer1 As Signer = New Signer With {
.Email = signerEmail,
.Name = signerName,
.ClientUserId = signerClientId,
.RecipientId = "1"
}
Dim signer2 As Signer = New Signer With {
.Email = signerEmail2,
.Name = signerName2,
.ClientUserId = signerClientId2,
.RecipientId = "2"
}
This will appear for both signer as same message, i need to make each signer name need to show there.
envelopeDefinition.EmailBlurb ="Dear. A Thanks and regards"
This article shows how to do that in six langs, including C#. I have converted the C# to VB.NET for you and here it is:
Dim signer1 As Signer = New Signer With {
.Email = "inbar#example.com",
.Name = "Inbar Gazit",
.RecipientId = "1",
.RoutingOrder = "1",
.EmailNotification = New RecipientEmailNotification With {
.EmailSubject = "Custom email subject for signer 1",
.EmailBody = "Custom email body for signer 1"
}
}Z

System.Threading.Tasks error when trying to call API

I am new to vb.net code. I have to call external API from vb.net. I tried the code below but it is throwing an error - getting issue as
System.Threading.Tasks.k`1
Public Shared Async Function GetToken_saka() As Task(Of sakaweb)
Dim req As New HttpRequestMessage(HttpMethod.Post, "https://api.qa.se.com/token")
' req.Content = New FormUrlEncodedContent(New Dictionary < String, String > {
' {"client_id", "your client_id"},
' {"client_secret", "your client_secret"},
' {"grant_type", "client_credentials"}
'});
Dim dct As New Dictionary(Of String, String)
dct.Add("client_id", "your_client_id")
dct.Add("client_secret", "your_client_secret")
dct.Add("grant_type", "client_credentials")
Dim htc As New HttpClient
req.Content = New FormUrlEncodedContent(dct)
Dim response = Await htc.SendAsync(req)
response.EnsureSuccessStatusCode()
'Dim payload = JObject.Parse(Await response.Content.ReadAsStringAsync())
Dim payload = JsonConvert.DeserializeObject(response.ToString)
Dim token = payload.Value(Of String)("access_token")
Dim t1 As sakaweb = Nothing
Return t1
'Dim t1 As New Task("K")
'Return t1
End Function

Docusing i want to send additional file in same envelope id using vb.net

i am using following code to send file with create envelope and signer and where to sign.
Imports System
Imports System.Collections.Generic
Imports DocuSign.eSign.Api
Imports DocuSign.eSign.Client
Imports DocuSign.eSign.Model
Imports Microsoft.AspNetCore.Mvc
Private Function DoWork(ByVal signerEmail As String, ByVal signerName As String, ByVal ccEmail As String, ByVal ccName As String, ByVal accessToken As String, ByVal basePath As String, ByVal accountId As String, ByVal templateId As String) As String
Dim config = New Configuration(New ApiClient(basePath))
config.AddDefaultHeader("Authorization", "Bearer " & accessToken)
Dim envelopesApi As EnvelopesApi = New EnvelopesApi(config)
Dim envelope As EnvelopeDefinition = MakeEnvelope(signerEmail, signerName, ccEmail, ccName, templateId)
Dim result As EnvelopeSummary = envelopesApi.CreateEnvelope(accountId, envelope)
Return result.EnvelopeId
End Function
Private Function MakeEnvelope(ByVal signerEmail As String, ByVal signerName As String) As EnvelopeDefinition
Dim buffer As Byte() = System.IO.File.ReadAllBytes(Config.docPdf)
Dim envelopeDefinition As EnvelopeDefinition = New EnvelopeDefinition()
envelopeDefinition.EmailSubject = "Please sign this document"
Dim doc1 As Document = New Document()
Dim doc1b64 As String = Convert.ToBase64String(buffer)
doc1.DocumentBase64 = doc1b64
doc1.Name = "Lorem Ipsum"
doc1.FileExtension = "pdf"
doc1.DocumentId = "3"
envelopeDefinition.Documents = New List(Of Document) From {
doc1
}
Dim signer1 As Signer = New Signer With {
.Email = signerEmail,
.Name = signerName,
.ClientUserId = signerClientId,
.RecipientId = "1"
}
Dim signHere1 As SignHere = New SignHere With {
.AnchorString = "/sn1/",
.AnchorUnits = "pixels",
.AnchorXOffset = "10",
.AnchorYOffset = "20"
}
Dim signer1Tabs As Tabs = New Tabs With {
.SignHereTabs = New List(Of SignHere) From {
signHere1
}
}
signer1.Tabs = signer1Tabs
Dim recipients As Recipients = New Recipients With {
.Signers = New List(Of Signer) From {
signer1
}
}
envelopeDefinition.Recipients = recipients
envelopeDefinition.Status = "sent"
Return envelopeDefinition
End Function
i take working solution from this link In Docusign using with Chilkat dll , how to pass templateRoles in json? by Inbar Gazit. i can send and get envelope id as return summary.
Now i want to add additional file which first file is signed by all signer. Same like again need to add 3rd file which 2nd file is signed by all signer in same envelope id. We use docusign connect to trigger event when signed by all signer.So we know document is singed by all signer or not.
In what way we can add additional document in same envelope id and send it again using Docusing dll. i have working c# project which download from docusign quickstart in that got 31 examples.
Note i am not use docusing rest or soap api.
Eg: We have machinery product company, First we send agreement related to product and prices to the signer, once get back agreement file signed by all, then we deploy and setup machinery in customer place once done ,then we send second acknowledge document to singer, once signed by all , filly we send finishing contract document. So we send all 3 files in same envelopeid in one by one.
Regards and Thanks
Aravind
I think you just want one more document, then it's simple, add/change this code:
Dim doc1 As Document = New Document()
Dim doc1b64 As String = Convert.ToBase64String(buffer)
doc1.DocumentBase64 = doc1b64
doc1.Name = "Lorem Ipsum"
doc1.FileExtension = "pdf"
doc1.DocumentId = "3"
Dim doc2 As Document = New Document()
Dim doc2b64 As String = Convert.ToBase64String(buffer2)
doc2.DocumentBase64 = doc2b64
doc2.Name = "Second doc"
doc2.FileExtension = "pdf"
doc2.DocumentId = "4"
envelopeDefinition.Documents = New List(Of Document) From {
doc1, docs2
}

Request Signature Docusign Rest API vb.net

am trying to use the DocuSign .Net Client to request a signature on a Document I am creating dynamically. So far, I have been able to change the example to vb.net and it works (Exmaple CS). I was converting the "Walkthrough #4 - Request Signature on Document", about 1/2 way down the code. Now I am trying to use the Envelope.Document I've seen in other examples, such as, DocuSign example. But it seems .Document is not part of Envelope, even thought the rest of the code in both examples translates to vb.
My other option is to use the Envelope.AddDocument but I can't seem to figure out what it's expecting. I am supposed to pass fileBytes() as Byte, fileName as String, and index As Integer. I've tried a couple different methods to get the fileBytes but keep getting an error about Invalid_Content_Type Content type is not supported.
Here is the code I've been trying. Any help on how to add a Document to an Envelope would be appreciated. Ultimately I want to be able to add multiple documents to the one envelope. I can get the env.Create(docPath) to work, but that is not helpful.
Thank you in advance for any help you can offer.
Public Function RequestEsignature(email As String, rName As String, docPath As String, strSubject As String) As String
main()
Dim AccountEmail = My.Settings.docusignUserName
Dim AccountPassword = My.Settings.docusignPassword
Dim RecipientEmail = email
Dim RecipientName = rName
Dim documentPath = docPath
Dim msgString As String
Dim acct As Account = New Account()
acct.Email = AccountEmail
acct.Password = AccountPassword
Dim result As Boolean = acct.Login()
If Not result Then
msgString = String.Format("There was an error logging in to DocuSign fo user {0}.\nError Code: {1}\nMessage: {2}", acct.Email, acct.RestError.errorCode, acct.RestError.message)
MsgBox(msgString)
Return Nothing
End If
Dim env As Envelope = New Envelope
env.Login = acct
env.Recipients = New Recipients()
Dim signer(0) As Signer
signer(0) = New Signer()
signer(0).email = email
signer(0).name = RecipientName
signer(0).routingOrder = "1"
signer(0).recipientId = "1"
env.Recipients.signers = signer
Dim envDocs = New Document()
envDocs.documentId = "1"
envDocs.name = "Test Document"
envDocs.uri = docPath
'Dim fileBytes As Byte()
'Dim fileBytes = getByteArrayII(documentPath)
'Dim oFile As FileInfo
'oFile = New FileInfo(documentPath)
'Dim oFileStream As FileStream = oFile.OpenRead()
'Dim lBytes As Long = oFileStream.Length
'If lBytes > 0 Then
' Dim fileData(lBytes - 1) As Byte
' oFileStream.Read(fileData, 0, lBytes)
'If Not env.AddDocument(fileBytes, documentPath, 0) Then
' msgString = String.Format("The was an Error adding the Document." & vbCrLf & "Error Code: {0} " & vbCrLf & "Message: {1}", env.RestError.errorCode, env.RestError.message)
' MsgBox(msgString)
' Return Nothing
'Else
' MsgBox("Doc Successfully Added")
'End If
'oFileStream.Close()
'End If
env.Status = "sent"
env.EmailSubject = strSubject
result = env.Create()
If Not result Then
If Not IsNothing(env.RestError) Then
msgString = String.Format("Error Code: {0}\nMessage: {1}", env.RestError.errorCode, env.RestError.message)
MsgBox(msgString)
Return Nothing
Else
MsgBox("There was a nondescript error while processing this request. \nPLease verify all information is correct before trying again.")
Return Nothing
End If
Else
Return env.EnvelopeId
End If
End Function
Private Function getByteArray(fileName As String) As Byte()
Dim fInfo As New FileInfo(fileName)
Dim numBytes As Long = fInfo.Length
Dim fStream As New FileStream(fileName, FileMode.Open, FileAccess.Read)
Dim br As New BinaryReader(fStream)
Dim data As Byte() = br.ReadBytes(CInt(numBytes))
br.Close()
fStream.Close()
Return data
End Function
Private Function getByteArrayII(ByVal fileName As String) As Byte()
Dim tempByte() As Byte = Nothing
If String.IsNullOrEmpty(fileName) Then
Throw New ArgumentNullException("FileName Not Provided")
Return Nothing
End If
Try
Dim fileInfo As New FileInfo(fileName)
Dim numBytes As Long = fileInfo.Length
Dim fStream As New FileStream(fileName, FileMode.Open, FileAccess.Read)
Dim binaryReader As New BinaryReader(fStream)
tempByte = binaryReader.ReadBytes(Convert.ToInt32(numBytes))
fileInfo = Nothing
numBytes = 0
fStream.Close()
fStream.Dispose()
Return tempByte
Catch ex As Exception
Return Nothing
End Try
End Function
HISTORY
I am new to vb.net and programming. Thus far I have been able to make a program that allows users to enter client information with the forms being changed based on certain selections. We have a system that uses our SQL data to do mail merges in Word and then send a PDF for esignature to the client through DocuSign. We are using a SQL backend and a vb.net front end.
Lastly, I have been looking for an answer over the weekend and am now reaching out for help. I have searched google for every possible term(s) I can think to include/exclude. If I am asking publicly that truly means I have exhausted every resource I have. Please do not post links to any DocuSign Documentation as I have already visited all those sites. Thank you.
It doesn't appear that the Envelope class has a Document property, but rather a Documents property which seems to be an array.
The C# example you posted at this link seems to show how to attach a document:
// Attach the document(s) C#
envelope.Documents = new DocuSignWeb.Document[1];
DocuSignWeb.Document doc = new DocuSignWeb.Document();
doc.ID = "1";
doc.Name = "Document Name";
doc.PDFBytes = [Location of Document];
envelope.Documents[0] = doc;
Which in VB would be something like this:
'Attach the document(s) VB
envelope.Documents = new DocuSignWeb.Document(0);
Dim doc As New DocuSignWeb.Document()
doc.ID = "1"
doc.Name = "Document Name"
doc.PDFBytes = [Location of Document]
envelope.Documents(0) = doc
If this is not the problem you are facing, please provide additional details.
Clearly my approach to learning vb, api's and all the other stuff needed to get my program working is extremely daunting. I am not sure if it is my lack of knowledge or just a misunderstanding of the code, but I was finally able to get this figured out.
My function takes an object 'client' that has things like Name and Email, I also pass a list of Document Paths and the Subject line for the email. This loops through the list of documents and adds them to the envelope. I also have some examples of adding Tags which was a learning process in itself. I hope I am the only one unfortunate enough to have to be learning so many different new concepts that something this simple takes months to figure out, but if not here's the code:
'Request Signature - Send Envelope
Public Function RequestEsignature(pClient As iqClient, docPaths As List(Of String), strSubject As String) As DocuSign.Integrations.Client.Envelope
'*****************************************************************
' ENTER VALUES FOR FOLLOWING VARIABLES!
'*****************************************************************
Dim AccountEmail As String = My.Settings.docusignUserName
Dim AccountPassword As String = My.Settings.docusignPassword
Dim RecipientEmail As String = pClient.Email
Dim RecipientName As String = pClient.Name.NameFL
'*****************************************************************
' user credentials
Dim account As New Account()
account = LoginToDocusign()
If Not IsNothing(account) Then
End If
Dim result As Boolean ' = account.Login()
' create envelope object and assign login info
Dim envelope As New Envelope()
Dim recip = New Recipients()
Dim signers = New List(Of Signer)
Dim signer As New Signer()
signer.email = RecipientEmail
signer.name = RecipientName
signer.routingOrder = "1"
signer.recipientId = "1"
Dim fileBytes = New List(Of Byte())
Dim docNames = New List(Of String)
Dim iqDoc As iqPublicClasses.iqDocement
Dim docs = New List(Of Document)
Dim doc As Document
Dim tabs = New List(Of Tab)
Dim tab As New Tab()
Dim iTabs = New List(Of Tab)
Dim iTab As New Tab()
Dim dTabs = New List(Of DateSignedTab)
Dim dTab As New DateSignedTab
Dim rTabs = New List(Of RadioGroupTab)
Dim rTab As New RadioGroupTab()
Dim radios = New List(Of Radios)
Dim radio As New Radios()
tab = New Tab()
tab.anchorIgnoreIfNotPresent = True
tab.anchorString = "\s1\"
tabs.Add(tab)
dTab = New DateSignedTab
dTab.anchorIgnoreIfNotPresent = True
dTab.anchorString = "\d1\"
dTabs.Add(dTab)
iTab = New Tab()
iTab.anchorIgnoreIfNotPresent = True
iTab.anchorString = "\i1\"
iTab.anchorYOffset = 15
iTabs.Add(iTab)
iTab = New Tab()
iTab.anchorIgnoreIfNotPresent = True
iTab.anchorString = "\nri1\"
iTabs.Add(iTab)
rTab = New RadioGroupTab()
rTab.groupName = "RG1"
rTab.anchorIgnoreIfNotPresent = True
radio = New Radios()
radio.anchorString = "\rbn\"
radio.anchorIgnoreIfNotPresent = True
radio.anchorYOffset = -10
radios.Add(radio)
radio = New Radios()
radio.anchorString = "\rby\"
radio.anchorIgnoreIfNotPresent = True
radio.anchorYOffset = -10
radios.Add(radio)
rTab.radios = radios.ToArray
rTabs.Add(rTab)
signer.tabs = New Tabs()
signer.tabs.signHereTabs = tabs.ToArray
signer.tabs.dateSignedTabs = dTabs.ToArray
signer.tabs.initialHereTabs = iTabs.ToArray
signer.tabs.radioGroupTabs = rTabs.ToArray
Dim cnt = 0
For Each docName As String In docPaths
cnt += 1
iqDoc = New iqPublicClasses.iqDocement(docName)
doc = New Document()
doc.attachmentDescription = iqDoc.Name
doc.name = String.Format("{0}{1}", iqDoc.Name, iqDoc.Extension)
doc.fileExtension = iqDoc.Extension
doc.uri = iqDoc.FullPath
doc.documentId = cnt
docs.Add(doc)
docNames.Add(iqDoc.FullPath)
fileBytes.Add(File.ReadAllBytes(iqDoc.FullPath))
Next
' create envelope and send the signature request (since status is set to "sent")
envelope.Login = account
signers.Add(signer)
recip.signers = signers.ToArray
envelope.Recipients = recip
envelope.Status = "sent"
envelope.EmailSubject = strSubject
result = envelope.Create(fileBytes, docs)
If Not result Then
If envelope.RestError IsNot Nothing Then
Console.WriteLine("Error code: {0}" & vbLf & "Message: {1}", envelope.RestError.errorCode, envelope.RestError.message)
Return Nothing
Else
Console.WriteLine("Error encountered while requesting signature from template, please review your envelope and recipient data.")
Return Nothing
End If
Else
Console.WriteLine("Signature request has been sent to {0}, envelopeId is {1}.", envelope.Recipients.signers(0).email, envelope.EnvelopeId)
Return envelope
End If
End Function
PS - As I've said I am extremely new to this and am learning as I am going. I understand this may not be the most elegant approach or properly formatted code, but I unfortunately have very little time to go back an update code I've written. Hopefully one day I will be able to go back and fix all the stuff I didn't understand when I first created it.