Reputation: 1
The login was using a developer sandbox account. If the recipent email is the same as the sender login acoount email, everything worked fine. But if they are different, the rest error ACCOUNT NOT AUTHORIZED FOR ENVELOPE
was thrown when calling envelope.GetRecipientView. The envelop was created successfully. The see my code below.
Private Sub SendDocToSign(ByVal docPDF As Byte())
Dim clsQuote As New clsQuote
Dim objDatabase As New clsDatabase
Try
' configure application's integrator key and webservice url
RestSettings.Instance.IntegratorKey = AppSettings("IntegratorsKey")
RestSettings.Instance.DocuSignAddress = "https://" & AppSettings("PAGE_DOCUSIGN")
RestSettings.Instance.WebServiceUrl = RestSettings.Instance.DocuSignAddress & "/restapi/v2"
RestSettings.Instance.FeatureSetId = "........"
System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls Or System.Net.SecurityProtocolType.Ssl3
System.Net.ServicePointManager.Expect100Continue = False
' credentials for sending account
Dim account As Account = New Account()
account.Email = AppSettings("APIUserEmail")
account.Password = AppSettings("Password")
account.ApiPassword = AppSettings("Password")
account.Proxy = New System.Net.WebProxy("Proxy Server", True)
account.Proxy.Credentials = System.Net.CredentialCache.DefaultCredentials
' make the Login API call
Dim result As Boolean = account.Login()
If result = False Then
Response.Write("Login Failed: " & result & " " & account.RestError.message)
Return
End If
Dim recipients As Recipients = New Recipients()
Dim signer As Signer = New Signer
signer.email = MyBase.pEmail
signer.name = MyBase.pContactName
signer.recipientId = "1"
signer.routingOrder = "1"
'signer.clientUserId = "1000"
Dim Signers(0) As Signer
Signers(0) = signer
recipients.signers = Signers
Dim tabs As New TabCollection()
Dim tab As New Tab()
tab.pageNumber = 3
tab.xPosition = 31
tab.yPosition = 382
tab.recipientId = "1"
tab.documentId = 1
tabs.signHereTabs.Add(tab)
Dim texttab As New TextTab()
texttab.pageNumber = 3
texttab.xPosition = 31
texttab.yPosition = 475
texttab.recipientId = "1"
texttab.documentId = 1
tabs.textTabs.Add(texttab)
Dim datetab As New DateSignedTab()
datetab.pageNumber = 3
datetab.xPosition = 480
datetab.yPosition = 417
datetab.recipientId = "1"
datetab.documentId = 1
tabs.dateSignedTabs.Add(datetab)
' create envelope object and assign login info
Dim envelope As New Envelope()
envelope.Login = account
' add one signer to the envelope
envelope.Recipients = recipients
' send the envelope immediately (otherwise set to "created" to save as draft envelope)
envelope.Status = "sent"
' email subject is required
envelope.EmailSubject = "Signature Request on Application"
Dim FileName = MyBase.pReferenceNum & AppSettings("PDF_FILE_EXT")
result = envelope.Create(docPDF, FileName)
If result = False Then
Response.Write("Envelope Creation Failed: " & result & " " & envelope.RestError.message)
Return
End If
result = envelope.GetRecipientView("afterDocuSign.aspx", True)
If result = False Then
Response.Write("GetRecipientView Failed: " & result & " " & envelope.RestError.message)
Return
End If
result = envelope.AddTabs(tabs)
If result = False Then
Response.Write("Tab addition failed: " & result & " " & envelope.RestError.message)
Return
End If
MyBase.pEnvelopeID = envelope.EnvelopeId
MyBase.SetQuoteSession()
clsQuote.Put_DocuSign_Rec(envelope.EnvelopeId, MyBase.pReferenceNum, envelope.Status)
Response.Redirect(envelope.SenderViewUrl)
Catch ex As Exception
Throw
End Try
End Sub
Upvotes: 0
Views: 863
Reputation: 9356
Some possible reasons:
Checking on an envelope that was created from another account (ie you can only see envelopes in the same account that you've sent, you were a signer, or if you're an admin in the account.
Wrong environment - i.e. you've created the envelope in production (www) but you are checking on an envelope in your developer sandbox account (demo).
You are not setting the clientUserId
property when adding the recipient to the envelope.
The setting that allows Embedded Signing is not enabled in the account you're sending the envelope from.
For this last one all dev sandbox accounts have Embedding enabled by default but if you're testing in demo and it somehow got turned off in your account you'll have to reach out to your account manager or DS support to have enabled. Follow up with the nurture emails you received after account creation if you want to talk to an Account Manager.
Upvotes: 1