简体   繁体   中英

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. Nothing is giving me an issue till I tried adding in the full name on the signer object like so,

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. I am using the latest 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:

Name - Legal full name, can include middle name, 100 characters max, require field

FullName - DocuSign uses that internally to combine first+last.

FirstName - Only first name, 50 characters max, optional field.

LastName - Only last name, 50 characters max, optional field.

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? 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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM