示例#1
0
        public void GenerateDocument(string name, string email)
        {
            var docuSignClient = new DocuSignClient(this.DocuSignCredentials);
            var accountId      = docuSignClient.AccountId;

            // assign recipient to template role by setting name, email, and role name.  Note that the
            // template role name must match the placeholder role name saved in your account template.
            var templateRoles = this.DocuSignTemplate.TemplateRoleNames.Select(m => new TemplateRole
            {
                Email    = email,
                Name     = name,
                RoleName = m
            }).ToList();

            // create a new envelope which we will use to send the signature request
            var envelope = new EnvelopeDefinition
            {
                EmailSubject  = this.EmailTemplate.Subject,
                EmailBlurb    = this.EmailTemplate.MessageBody,
                TemplateId    = this.DocuSignTemplate.TemplateId,
                TemplateRoles = templateRoles,
                Status        = "sent"
            };

            // |EnvelopesApi| contains methods related to creating and sending Envelopes (aka signature requests)
            var envelopesApi    = new EnvelopesApi();
            var envelopeSummary = envelopesApi.CreateEnvelope(accountId, envelope);
        }
        public IEnumerable <Envelope> ListEnvelopes(int numberOfItems)
        {
            var docuSignClient = new DocuSignClient(this.DocuSignCredentials);
            var accountId      = docuSignClient.AccountId;

            var fromDate = DateTime.UtcNow;

            fromDate = fromDate.AddDays(-30);
            string fromDateStr = fromDate.ToString("o");

            // set a filter for the envelopes we want returned using the fromDate and count properties
            var options = new EnvelopesApi.ListStatusChangesOptions()
            {
                count    = numberOfItems.ToString(),
                fromDate = fromDateStr
            };

            EnvelopesApi envelopesApi = new EnvelopesApi();

            return(envelopesApi.ListStatusChanges(accountId, options).Envelopes);
        }