类型'字符串'的错误值无法转换为' secure.echosign.com.ArrayOfString'

时间:2014-08-18 15:36:19

标签: vb.net web-services echosign

我正在使用Adobe EchoSign Web服务在vb.net中创建SendDocument函数。我在这篇文章中尝试了解决方案Using EchoSign API in VB.net,但没有运气。

我收到错误

  

“String”类型的值无法转换为   'secure.echosign.com.ArrayOfString'

在我的代码中.recipients = recipients(0)

Public Sub SendDocument(ByVal apiKey, ByVal fileName, ByVal formFieldLayerTemplateKey, ByVal recipient)  

Dim recipients() As String = recipient

Dim docRecipient As RecipientInfo = New RecipientInfo()
With docRecipient
    .email = recipient
    .fax = "800-123-4567"
    .role = RecipientRole.SIGNER
End With

Dim docCreationInfo As DocumentCreationInfo = New DocumentCreationInfo()
With docCreationInfo
     .recipients = docRecipient(0)
     .name = Path.GetFileName(File.Name)
     .message = TestMessage
     .fileInfos = fileInfos
     .signatureType = SignatureType.ESIGN
    .signatureFlow = SignatureFlow.SENDER_SIGNATURE_NOT_REQUIRED
End With

当我尝试.recipients = recipients时,错误读取

  

类型'1维数组String'的值无法转换为   'secure.echosign.com.ArrayOfString'。

有关如何解决错误的任何建议?

1 个答案:

答案 0 :(得分:1)

尝试将RecipientInfo个对象数组分配到.recipients字段:

'create a RecipientInfo object
Dim docRecipient As RecipientInfo = New RecipientInfo
With docRecipient
    .email = recipient
    .fax = "800-123-4567"
    .role = RecipientRole.SIGNER
End With

'create a RecipientInfo array with your new object as its contents
Dim recipients() As RecipientInfo = { docRecipient }

'create a DocumentCreationInfo and assign the array to the recipients field
Dim docCreationInfo As DocumentCreationInfo = New DocumentCreationInfo
With docCreationInfo
    .recipients = recipients
    .name = Path.GetFileName(File.Name)
    .message = TestMessage
    .fileInfos = fileInfos
    .signatureType = SignatureType.ESIGN
    .signatureFlow = SignatureFlow.SENDER_SIGNATURE_NOT_REQUIRED
End With