Create a package as a draft
Monday, August 14, 2017 at 07:10amHello,
I am trying to create a document package and send it as a "draft".
Here is the code that I have came up with :
EslClient eslClient;
PackageId packageId = eslClient.CreatePackage(package);
if I want to create a package with a "sent" status instead of draft, I ad this line :
eslClient.SendPackage(packageId);
While this works, I have also found something strange :
When I first create my eSL package, I use the following code :
PackageBuilder packageBuilder = PackageBuilder
.NewPackageNamed(packageName)
.WithSettings(
DocumentPackageSettingsBuilder.NewDocumentPackageSettings())
.ExpiresOn(DateTime.Today.AddDays(daysBeforeExpiration))
.WithAttributes(packageAttributes);
I tried to play with the function "WithDocumentStatus()" to set the package either as a "DRAFT" or as a "SENT" package such as this :
.WithStatus(DocumentPackageStatus.DRAFT)
However, this doesn't seem to have any effect on the package status and the only way to set the package status seems to be my code above (create and send vs create only).
Hence my question, is the function "WithStatus()" useful at all ? if yes, what is it for ? what's the purpose of marking my package as a "DRAFT" if it gets sent when I invoke "create()" then "send() ?
Thanks
Reply to: Create a package as a draft
Monday, August 14, 2017 at 09:06amReply to: Create a package as a draft
Monday, August 14, 2017 at 12:18pmcreatePackage()
call, the package will automatically be placed in draft. There isn't really a need to define.WithStatus()
method. The SDK is built in such a way that it will create your package with the signer information and package settings(includes package status), upload your documents, and send the package (if you are usingCreateAndSendPackage()
). Hence, when you are trying to create a package with a SENT status, then you will get the error above as the SDK didn't upload the documents/add signatures just yet. The.WithStatus()
should really only be used when doing aeslClient.createPackageOneStep()
. This call creates a multipart/form-data request and creates and uploads your package in one request. Therefore, the.WithStatus()
method is valid in this situation.