0
我收到錯誤 無法加載模板。無法從TemplateReference(0)加載模板。錯誤:根級別的數據無效。行1,位置1.我得到c#和Docusign錯誤如何解決此錯誤
下面是我正在使用的代碼的簡化版本... 如果我不使用模板引用類型的代碼一切工作正常。但是,當我開始使用模板引用..沒有任何作品,我得到這個錯誤。任何人都有建議?
TemplateReference _tempRef = new TemplateReference();
TemplateReference[] _tempRefs = new TemplateReference[] { };
TemplateReferenceRoleAssignment[] _roleAssignmentArray = new TemplateReferenceRoleAssignment[] { };
Recipient[] _recipientsArray = new Recipient[] { };
EnvelopeInformation envelope = new EnvelopeInformation();
Recipient recipient = new Recipient();
recipient.ID = "1";
recipient.Email = "[email protected]";
recipient.UserName = "Some Person";
recipient.Type = RecipientTypeCode.Signer;
recipient.RequireIDLookup = false;
Array.Resize(ref _roleAssignmentArray, 1);
Array.Resize(ref _recipientsArray, 1);
_recipientsArray[0] = recipient;
var saRoleAssignment = new TemplateReferenceRoleAssignment
{
RecipientID = "1",
RoleName = "SA"
};
_roleAssignmentArray[0] = saRoleAssignment;
var reference = new Docusign.TemplateReference();
reference.Template = "49C0BE2B-48F7-4F38-B44A-19EB8E6A1A38";
reference.Document = new Docusign.Document();
reference.Document.PDFBytes = new byte[0];
reference.Document.ID = Convert.ToString(1);
reference.Document.Name = "please work";
reference.RoleAssignments = _roleAssignmentArray;
Array.Resize(ref _tempRefs, 1);
_tempRefs[1 - 1] = reference;
//.NET
//.NET
envelope.AccountId = "accountID";
envelope.Subject = "Sample Application";
envelope.EmailBlurb = "You can add a personal message here.";
APIServiceSoapClient apiService = new APIServiceSoapClient();
apiService.ClientCredentials.UserName.UserName = "userhere";
apiService.ClientCredentials.UserName.Password = "pass";
var status = apiService.CreateEnvelopeFromTemplates(_tempRefs, _recipientsArray, envelope, true);
看起來我缺少的是TemplateLocation = DocuSignAPI.TemplateLocationCode.Server行, – Rico