dgnice | Posts: 1

Sample Dotnet C#

0 votes

Hello,

We try to use .NET SDK , but you don't use C#, and try to translate to another language.

https://community.onespan.com/fr/documentation/onespan-sign/guides/guides-de-demarrage-rapide/developpeur/creation-et-envoi-dune-transaction#tab-header-1

We could not use :

DocumentPackage superDuperPackage = PackageBuilder
    .NewPackageNamed("Test Package .NET")
    .WithSettings(DocumentPackageSettingsBuilder.NewDocumentPackageSettings())

because  .WithSettings(DocumentPackageSettingsBuilder.NewDocumentPackageSettings()) is not accepted.

Have you another method to prepare document ? ( or another sample without abrevation of c# ? )

Regards

 

 


Duo_Liang | Posts: 3776

Reply to: Sample Dotnet C#

0 votes

Hi Dominique,

 

Thanks for your post! Which version of .NET platform/core and OSS .NET SDK are you developing with?

Below is an example code with .NET platform 4.8 + OSS .NET SDK 11.34 (not the latest):

            OssClient ossClient = new OssClient(apiKey, apiUrl);
            
            DocumentPackage newPackage = PackageBuilder.NewPackageNamed("Example Package created from new .NET SDK")
                .DescribedAs("It's a test package")
                .WithEmailMessage("Please sign ASAP!")
                .WithSigner(SignerBuilder.NewSignerWithEmail("[email protected]")
                        .WithFirstName("John")
                        .WithLastName("Smith"))
                .WithDocument(DocumentBuilder.NewDocumentNamed("Document1")
                        .FromFile("path_to_your_document")
                        .WithSignature(SignatureBuilder.SignatureFor("[email protected]")
                            .OnPage(0).AtPosition(100,100).WithSize(150,50)))
                //.WithSettings(DocumentPackageSettingsBuilder.NewDocumentPackageSettings())
                .WithStatus(DocumentPackageStatus.SENT)
                .Build();

            var packageId = ossClient.CreatePackageOneStep(newPackage);
            Debug.WriteLine("packageId: {0}", packageId);

 

It works either way with or without the commented line.

 

Duo


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