Docusign webservice使用vb.net - 锚标签自定义

时间:2013-11-14 14:20:55

标签: vb.net docusignapi

这是我遇到的问题。

我有一份使用DocuSign网络服务创建的文档。

我可以在其上创建普通字段/标签,即SignHere / SignDate / Initial字段。

然而,当我想使用自定义字段时,它只是不起作用。代码运行并发送文档,但所有位于EXPECTED自定义字段的位置只是一个文本框。这就像是忽略了自定义字段设置。

我附上了我正在使用的文件以供参考,我的代码如下。

一切正常,但我认为应该是两个客户领域的部分是问题。

Dim DocuSignSoap As New ServiceReference2.DSAPIServiceSoapClient
Dim DocuSignRecipient(0) As ServiceReference2.Recipient
Dim DocuSignRecipientType As ServiceReference2.RecipientTypeCode
Dim DocuSignTabType As ServiceReference2.TabTypeCode
Dim DocuSignCustomTabType As ServiceReference2.CustomTabType
Dim DocuSignEnvelope As New ServiceReference2.Envelope
Dim DocuSignDocument(0) As ServiceReference2.Document
Dim DocuSignTab(7) As ServiceReference2.Tab
Dim DocuSignEnvelopeStatus As ServiceReference2.EnvelopeStatus
Dim DocusignSig1 As New ServiceReference2.AnchorTab
Dim DocusignSig2 As New ServiceReference2.AnchorTab
Dim DocusignDateLOA As New ServiceReference2.AnchorTab
Dim DocusignDDDate As New ServiceReference2.AnchorTab
Dim DocusignFreq1 As New ServiceReference2.AnchorTab
Dim DocusignFreq2 As New ServiceReference2.AnchorTab
Dim DocusignFreq3 As New ServiceReference2.AnchorTab
Dim DocusignFreq4 As New ServiceReference2.AnchorTab
Dim strAuth As String
Dim strDocID As String

strDocID = Format(Now, "ddMMyyyyhhmmss")

Dim Mystream As New FileStream("c:\dantestdocusign.pdf", FileMode.Open)
Dim filesize As Long = Mystream.Length
Dim buffer(filesize) As Byte

Mystream.Read(buffer, 0, filesize)
Mystream.Close()

'Create Recipent
DocuSignRecipient(0) = New ServiceReference2.Recipient
DocuSignRecipient(0).Email = "daniel.rodgers@idebtplan.co.uk"
DocuSignRecipient(0).UserName = "Daniel Rodgers"
DocuSignRecipient(0).SignerName = "Daniel Rodgers"
DocuSignRecipient(0).Type = DocuSignRecipientType.Signer
DocuSignRecipient(0).ID = "1"
DocuSignRecipient(0).RoutingOrder = 1

'Create the envelope content
DocuSignEnvelope.Subject = "Your iDebtPlan Pack"
DocuSignEnvelope.EmailBlurb = "Email content"
DocuSignEnvelope.Recipients = DocuSignRecipient
DocuSignEnvelope.AccountId = "2f447fb0-243a-4a3f-acb5-adefbef43492"

'Create the document
DocuSignDocument(0) = New ServiceReference2.Document
DocuSignDocument(0).ID = strDocID
DocuSignDocument(0).Name = "DAN TESTING DOC"
DocuSignDocument(0).PDFBytes = buffer

' Attach the document(s)
DocuSignEnvelope.Documents = DocuSignDocument

' Create a new signature tab 1
DocuSignTab(0) = New ServiceReference2.Tab
DocuSignTab(0).DocumentID = DocuSignDocument(0).ID
DocuSignTab(0).RecipientID = "1"
DocuSignTab(0).Type = DocuSignTabType.SignHere
DocusignSig1.AnchorTabString = "\s1\"
DocuSignTab(0).AnchorTabItem = DocusignSig1
DocuSignTab(0).TabLabel = "Sig1"

' Create a new signature tab 2
DocuSignTab(1) = New ServiceReference2.Tab
DocuSignTab(1).DocumentID = DocuSignDocument(0).ID
DocuSignTab(1).RecipientID = "1"
DocuSignTab(1).Type = DocuSignTabType.SignHere
DocusignSig2.AnchorTabString = "\s2\"
DocuSignTab(1).AnchorTabItem = DocusignSig2
DocuSignTab(1).TabLabel = "Sig2"

' Create a DateLOA
DocuSignTab(2) = New ServiceReference2.Tab
DocuSignTab(2).DocumentID = DocuSignDocument(0).ID
DocuSignTab(2).RecipientID = "1"
DocuSignTab(2).Type = DocuSignTabType.DateSigned
DocusignDateLOA.AnchorTabString = "\loadate\"
DocuSignTab(2).AnchorTabItem = DocusignDateLOA
DocuSignTab(2).TabLabel = "DateLOA"

'CUSTOM FIELD 1
' Create a DD Date
DocuSignTab(3) = New ServiceReference2.Tab
DocuSignTab(3).DocumentID = DocuSignDocument(0).ID
DocuSignTab(3).RecipientID = "1"
DocuSignTab(3).Type = 11
DocuSignTab(3).CustomTabType = 4 'date
DocuSignTab(3).CustomTabWidth = 100
DocuSignTab(3).CustomTabDisableAutoSize = True
DocuSignTab(3).CustomTabRequired = True
DocuSignTab(3).CustomTabValidationPattern ="(^(?:(?:[12][0-9]|0?[1-9])/0?2|(?:30|[12][0-9]|0?[1-9])/(?:0?[469]|11)|(?:3[01]|[12][0-9]|0?[1-9])/(?:0?[13578]|1[02]))/\d{4}$)"
DocuSignTab(3).MaxLength = 10
DocuSignTab(3).CustomTabValidationMessage = "Your First Payment Date
Must be format dd/mm/yyyy (example: 01/03/2012), and a valid UK Date"
DocusignDDDate.AnchorTabString = "\dddate\"
DocuSignTab(3).AnchorTabItem = DocusignDDDate
DocuSignTab(3).TabLabel = "DDDate"

'CUSTOM FIELD 2
''Create Frequency Radio Buttons
DocuSignTab(4) = New ServiceReference2.Tab
DocuSignTab(4).DocumentID = DocuSignDocument(0).ID
DocuSignTab(4).RecipientID = "1"
DocuSignTab(4).Type = 11
DocuSignTab(4).CustomTabType = 2 'radio
DocuSignTab(4).CustomTabRequired = True
DocuSignTab(4).CustomTabWidth = 100
DocuSignTab(4).CustomTabDisableAutoSize = True
DocuSignTab(4).CustomTabRadioGroupName = "Frequency"
DocuSignTab(4).TabLabel = "Frequency"
DocuSignTab(4).Value = ""
DocusignFreq1.AnchorTabString = "\ow\"
DocuSignTab(4).AnchorTabItem = DocusignFreq1
DocuSignEnvelope.Tabs = DocuSignTab

strAuth = "<DocuSignCredentials<Usernameinfo@idebtplan.co.uk<mailto:info@idebtplan.co.uk</Username<Passwordjemima79</Password<IntegratorKeyIDEB-8ce296aa-0dff-4347-8ece-b62836a6a94e</IntegratorKey</DocuSignCredentials"


Dim x As New OperationContextScope(DocuSignSoap.InnerChannel)
Dim httpRequest As New System.ServiceModel.Channels.HttpRequestMessageProperty
httpRequest.Headers.Add("X-DocuSign-Authentication", strAuth)
OperationContext.Current.OutgoingMessageProperties(httpRequest.Name) = httpRequest

' Create the envelope on the account -- it will be a draft
DocuSignEnvelopeStatus = DocuSignSoap.CreateAndSendEnvelope(DocuSignEnvelope)
buffer = Nothing
Mystream = Nothing
httpRequest = Nothing

1 个答案:

答案 0 :(得分:0)

我建议如下:

  1. 尝试添加自定义字段而不使用锚标签(即使用绝对定位)
  2. 比较您使用SOAP SDK up on GitHub
  3. 中的示例代码配置自定义字段的方式
  4. 使用DocuSign中较新的REST API创建信封。