robadmiraal

How do I set "Accept only" for a signer using the .NET SDK

0 votes

In the designer of a package, there is a checkbox "Accept only" for a signer. How can I set this to true using the .NET SDK?

 


Approved Answer

Reply to: How do I set "Accept only" for a signer using the .NET SDK

0 votes

Hi Rob,

 

I see your concerns. In short, try to add accept-only approval for signer1 in a separate step, see below example code:
 

            DocumentPackage documentPackage = PackageBuilder.NewPackageNamed("Test Transaction")
                             .WithSigner(SignerBuilder.NewSignerWithEmail("[email protected]")
                                           .WithCustomId("Signer2")
                                           .WithFirstName("John")
                                           .WithLastName("Smith"))
                             .WithSigner(SignerBuilder.NewSignerWithEmail("[email protected]")
                                           .WithCustomId("Signer1")
                                           .WithFirstName("John")
                                           .WithLastName("Smith"))
                             .WithDocument(DocumentBuilder.NewDocumentNamed("Document1")
                                     .WithId("Document1")
                                     .EnableExtraction()
                                     .WithExtractionType(ExtractionType.TEXT_TAGS)

                                     .FromFile("...\\Example Text Tags.docx")
                              )
                              .Build();

            PackageId packageId = ossClient.CreatePackageOneStep(documentPackage);


            DocumentPackage createdPackage = ossClient.GetPackage(packageId);
            Signature signer1Approval = SignatureBuilder.AcceptanceFor("[email protected]").Build();
            ossClient.ApprovalService.AddApproval(createdPackage, "Document1", signer1Approval );
            ossClient.SendPackage(packageId);
            Debug.WriteLine(packageId);

 

Allowing a mix of signatures and accept-only is only supported in a recent release 11.50, however the SDK hasn't fully supported it yet. The above code could work it around though.

 

Duo

Duo Liang OneSpan Evangelism and Partner Integrations Developer


Reply to: How do I set "Accept only" for a signer using the .NET SDK

0 votes

Hi robadmiraal,

 

Thanks for your post! When adding signatures for signers, use SignatureBuilder.AcceptanceFor("signer_email") method instead of .SignatureFor() or .CaptureFor():

 

            DocumentPackage documentPackage = PackageBuilder.NewPackageNamed("Test Transaction")
                             .WithSigner(SignerBuilder.NewSignerWithEmail("[email protected]")
                                           .WithCustomId("Signer1")
                                           .WithFirstName("John")
                                           .WithLastName("Smith"))
                             .WithDocument(DocumentBuilder.NewDocumentNamed("Document1")
                                     .WithId("Document1")
                                     .FromFile("...\\4contract.pdf")
                                     .WithSignature(SignatureBuilder.AcceptanceFor("[email protected]")
                                      ) 

                              )
                              .Build();

 

Duo

Duo Liang OneSpan Evangelism and Partner Integrations Developer


Reply to: How do I set "Accept only" for a signer using the .NET SDK

0 votes

Thank you for the example. This works as long as I don't use EnableExtraction WithExtractionType(ExtractionType.TEXT_TAGS).

I have a Word document without any fields for Signer1 and with a capture field fot Signer2.If I remove the EnableExtraction lines, it works as proposed (but of course without the esl caputere extracted), and the first signer is marked as "Accept only". 

But when I use use EnableExtraction and WithExtractionType(ExtractionType.TEXT_TAGS), the first signer is not marked as "Accept only".

Is that a bug or am I missing something? 

 


Reply to: How do I set "Accept only" for a signer using the .NET SDK

0 votes

Thank you, this wordkaround works great.


Hello! Looks like you're enjoying the discussion, but haven't signed up for an account.

When you create an account, we remember exactly what you've read, so you always come right back where you left off