简体   繁体   English

创建信封定义时无法在签名者上传递全名

[英]Can't pass in a full name on the signer when creating the envelope definition

Using an almost identical setup to the quickstart project on the docusign site for creating the envelope definition.使用与 docusign 站点上的快速入门项目几乎相同的设置来创建信封定义。 Nothing is giving me an issue till I tried adding in the full name on the signer object like so,在我尝试在签名者 object 上添加全名之前,没有任何问题,

Signer signer = new Signer
        {
            Email = recipientEmail,
            Name = fullName,
            FirstName = recipientFirstName,
            LastName = recipientLastName,
            RecipientId = "1",
            RoutingOrder = "1",
        };

For whatever reason when there is a space given in the name I get a 500 back.无论出于何种原因,当名称中有空格时,我都会得到 500 的回报。 I am using the latest nuget(5.8.0).我正在使用最新的 nuget(5.8.0)。 If I take out the space then the everything is fine.如果我拿出空间,那么一切都很好。 Unless I am not supposed to use this field, how am I supposed to pass in the full name of the signer?除非我不应该使用这个字段,否则我应该如何传递签名者的全名?

Adding the full code that I am currently working with,添加我目前正在使用的完整代码,

    public string GetSigningUrl(FileItem fileItem, string recipientEmail, string recipientFirstName, string recipientLastName)
    {
        string clientUserId = Guid.NewGuid().ToString();

        EnvelopesApi envelopeApi = CreateEnvelopeApi();
        EnvelopeSummary envelopeSummary = CreateEnvelope(fileItem, recipientEmail, recipientFirstName, recipientLastName, envelopeApi, clientUserId);
        RecipientViewRequest viewRequest = MakeRecipientViewRequest(recipientEmail, recipientFirstName, clientUserId);

        return envelopeApi.CreateRecipientView(_docuSignAuthorizationService.AccountID, envelopeSummary.EnvelopeId, viewRequest).Url;
    }
    protected EnvelopeDefinition CreateEnvelopDefinition(FileItem fileItem, string recipientEmail, string recipientFirstName, string recipientLastName, ref EnvelopesApi envelopesApi, string clientUserId = null)
    {
        Document document = new Document
        {
            DocumentBase64 = Convert.ToBase64String(fileItem.Data),
            Name = "Lorem Ipsum", //fileItem.FileName,
            FileExtension = "pdf", //fileItem.ContentType,
            DocumentId = "1"
        };
        Document[] documents = new Document[] { document };

        Signer signer = new Signer
        {
            Email = recipientEmail,
            Name = $"{recipientFirstName} {recipientLastName}",
            //FullName = $"{recipientFirstName} {recipientLastName}",
            RecipientId = "1",
            RoutingOrder = "1",
        };

        if (clientUserId != null)
            signer.ClientUserId = clientUserId;

        // signing field on the document
        SignHere signHereTab = new SignHere
        {
            DocumentId = "1",
            PageNumber = "1",
            RecipientId = "1",
            TabLabel = "Sign Here Tab",
            XPosition = "195",
            YPosition = "147"
        };
        SignHere[] signHereTabs = new SignHere[] { signHereTab };

        signer.Tabs = new Tabs { SignHereTabs = new List<SignHere>(signHereTabs) };
        Signer[] signers = new Signer[] { signer };
        Recipients recipients = new Recipients { Signers = new List<Signer>(signers) };
        EnvelopeDefinition envelopeDefinition = new EnvelopeDefinition
        {
            EmailSubject = "Please sign the document",
            Documents = new List<Document>(documents),
            Recipients = recipients,
            Status = "sent"
        };

        if (envelopesApi == null)
            envelopesApi = CreateEnvelopeApi();
        return envelopeDefinition;
    }

    protected EnvelopeSummary CreateEnvelope(FileItem fileItem, string recipientEmail, string recipientFirstName, string recipientLastName, EnvelopesApi envelopesApi = null, string clientUserId = null)
    {
        EnvelopeDefinition envelopeDefinition = CreateEnvelopDefinition(fileItem, recipientEmail, recipientFirstName, recipientLastName, ref envelopesApi, clientUserId);

        EnvelopeSummary results = envelopesApi.CreateEnvelope(_docuSignAuthorizationService.AccountID, envelopeDefinition);
        return results;
    }

There are 4 fields in the Signer object and we know it's a bit confusing, but here is me trying to explain:签名者 object 中有 4 个字段,我们知道这有点令人困惑,但我试图解释一下:

Name - Legal full name, can include middle name, 100 characters max, require field姓名- 法定全名,可包含中间名,最多 100 个字符,必填字段

FullName - DocuSign uses that internally to combine first+last. FullName - DocuSign 在内部使用它来组合 first+last。

FirstName - Only first name, 50 characters max, optional field. FirstName - 只有名字,最多 50 个字符,可选字段。

LastName - Only last name, 50 characters max, optional field. LastName - 只有姓氏,最多 50 个字符,可选字段。

I tried with spaces in all of these fields with latest nuget for C# and I don't get any error, if you do - can you share the values you used?我尝试使用最新的 nuget for C# 在所有这些字段中使用空格,如果你这样做了,我没有收到任何错误 - 你能分享你使用的值吗? it may be some other reason可能是其他原因

Turns out I was passing the wrong value into the recipient view request and that was causing the failure since the name did not match the value in the created envelope.原来我将错误的值传递给收件人视图请求,这导致了失败,因为名称与创建的信封中的值不匹配。

Below is the change that is now in there, where before the value entered into UserName was simply a fake value from a constant and not from my request data.下面是现在那里的更改,在输入到 UserName 之前的值只是来自常量而不是来自我的请求数据的假值。

RecipientViewRequest viewRequest = new RecipientViewRequest
        {
            AuthenticationMethod = "none",
            Email = signerEmail,
            UserName = signerName,
            ClientUserId = clientUserId,
            ReturnUrl = _docuSignConfig.RedirectUrl
        };

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如果使用完整路径调用,则Nuget无法读取AssemblyInfo.cs - Nuget can't read AssemblyInfo.cs if called with full path Nuget:此包已签名但不是由受信任的签名者签名 - Nuget: This package is signed but not by a trusted signer Nuget使用包名称创建文件夹 - Nuget creating a folder with the package name 创建 NuGet 包时不要包含来自 packages.config 文件的依赖项 - Don't include dependencies from packages.config file when creating NuGet package 创建NuGet PowerShell脚本时,如何分辨新安装和升级之间的区别? - When creating a NuGet PowerShell script, how can you tell the difference between a new install and upgrade? 在创建NuGet包时,我可以修改现有的源代码文件吗? - When creating a NuGet package, can I modify existing source code files? msbuild / t:Pack是否支持完整的.Net框架? - Is msbuild /t:Pack supported in full .Net framework? 创建包时找不到文件 - File not found when creating a package 错误“NU3034 此包已签名但不是由受信任的签名者签名” - Error "NU3034 This package is signed but not by a trusted signer" 当不满足依赖关系时,如何配置nuget不建议更新? - How can I configure nuget to not suggest Updates when Dependencies aren't met?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM