-->

DocuSign RestApi - Error while uploading document

2019-03-03 13:55发布

问题:

I'm getting the following error when I try to apply a template (created in my web account) to the document I'm trying to upload.

"DocumentId specified in the tab element does not refer to a document in this envelope. Tab refers to DocumentId 41791752 which is not present."

Any help would be greatly appreciated. Thanks.

Here's the code I have:

string xmlBody = "<envelopeDefinition xmlns=\"http://www.docusign.com/restapi\">" +
                "<emailSubject>DocuSign API - Signature Request"</emailSubject>" +
                "<status>sent</status>" +   // "sent" to send immediately, "created" to save as draft in your account
                   "<compositeTemplates>" +
                       "<compositeTemplate>" +
                           "<serverTemplates>" +
                                  "<serverTemplate>" +
                                       "<sequence>1</sequence>" +
                                       "<templateId>" + templateID + "</templateId>" +
                                  "</serverTemplate>" +
                           "</serverTemplates>" +
                           "<inlineTemplates>" +
                                  "<inlineTemplate>" +
                                      "<sequence>2</sequence>" +
                                      "<recipients>" +                                        
                                           "<signers>" +
                                                  "<signer>" +
                                                        "<recipientId>1</recipientId>" +
                                                        "<email>" + recipientEmail + "</email>" +
                                                        "<name>" + recipientName + "</name>" +
                                                        "<roleName>Signer</roleName>" +
                                                   "</signer>" +
                                             "</signers>" +                                       
                                       "</recipients>" +
                                  "</inlineTemplate>" +
                          "</inlineTemplates>" +
                           "<document>" +
                                 "<name>" + documentName + "</name>" +
                                 "<documentId>1</documentId>" +
                          "</document>" +
                    "</compositeTemplate>" +
                   "</compositeTemplates>" +
               "</envelopeDefinition>";

回答1:

The error message you quoted:

DocumentId specified in the tab element does not refer to a document in this envelope. Tab refers to DocumentId 41791752 which is not present.

I suggest that the template is referring to that documentId. But you're registering your document as Id 1.

Try changing

  "<documentId>1</documentId>" +
to
  "<documentId>41791752</documentId>" +