Skip to main content

Set the ExpireEnabled, ExpireAfter and ExpireDateTime using Docusign SDK 8 for C# and its not taking the values.
 

Key points :

  • Using Docusing SDK 8 with C#
  • Using developer account
  • I’m creating the envelope from a template.
  • I changed the expiration days in docuSign settings
  • These are the lines of code :
     

    // Get the envelope definition after configuration
    var envelopeDefinition = config.GetEnvelopeDefinition();

    // Set the envelope status to "sent". The signer will get an email from DocuSign
    envelopeDefinition.Status = "sent";

    // Set expiration date
    envelopeDefinition.ExpireEnabled = "true"; // Enable expiration
    envelopeDefinition.ExpireDateTime = DateTimeOffset.UtcNow.AddDays(14).ToString();
    envelopeDefinition.ExpireAfter = "14"; // Set expiration days

    // Initialize the EnvelopesApi client (reuse existing ApiClient)
    EnvelopesApi envelopesApi = new(this.ApiClient);

    // Create the envelope on DocuSign (it will not be sent due to the "created" status)
    EnvelopeSummary envelopeSummary = envelopesApi.CreateEnvelope(this.account.AccountId, envelopeDefinition);

    // Get envelope created to verify the expiration values
    Envelope envelope = envelopesApi.GetEnvelope(this.account.AccountId, envelopeSummary.EnvelopeId) ??
        throw new Exception($"Error cannot get envelope status.");

    Console.WriteLine($"ExpireEnabled: {envelope.ExpireEnabled}");   // displays "true"
    Console.WriteLine($"ExpireAfter: {envelope.ExpireAfter}");       // displays 120
    Console.WriteLine($"ExpireDateTime: {envelope.ExpireDateTime}"); // displays todaydate + 120 days
     

  • The envelope were created successfully but the “Expire” fields keeps taking the default value (120) even after I changed the default values in the DocuSign Admin settings.


What am I doing wrong ?

Hi,

 

Here is a great article that walks through it with examples: https://www.docusign.com/blog/developers/dsdev-common-api-tasks-add-reminders-and-expiration-to-an-envelope

It should be for example:

EnvelopeDefinition envelopeDefinition = new EnvelopeDefinition();
var notification = new Notification();
notification.UseAccountDefaults = "false"; // customize the notification for this envelope
notification.Reminders = new Reminders
{
ReminderEnabled = "true",
ReminderDelay = "3", // first reminder to be sent three days after envelope was sent
ReminderFrequency = "2" // keep sending reminders every two days
};
notification.Expirations = new Expirations
{
ExpireEnabled = "true",
ExpireAfter = "30", // envelope will expire after 30 days
ExpireWarn = "2" // expiration reminder would be sent two days before expiration
};
envelopeDefinition.Notification = notification;

 


Reply