Beispiel #1
0
        public EnvelopesInformation GetDocumentStatus(IList <string> envelopesIds)
        {
            var docuSignClient = new DocuSignClient(this.DocuSignCredentials);
            var accountId      = docuSignClient.AccountId;

            // |EnvelopesApi| contains methods related to creating and sending Envelopes (aka signature requests)
            var envelopesApi = new EnvelopesApi();

            // This example gets statuses of all envelopes in your account going back 1 full month...
            //DateTime 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
            //EnvelopesApi.ListStatusChangesOptions options = new EnvelopesApi.ListStatusChangesOptions()
            //{
            //	count = "50",
            //	fromDate = fromDateStr,
            //	status = "completed"
            //};

            //// |EnvelopesApi| contains methods related to envelopes and envelope recipients
            //EnvelopesInformation envelopes = envelopesApi.ListStatusChanges(accountId, options);

            //EnvelopesApi.ListStatusOptions options2 = new EnvelopesApi.ListStatusOptions()
            //{
            //	fromDate = fromDateStr,
            //};

            return(envelopesApi.ListStatus(accountId, new EnvelopeIdsRequest(envelopesIds.ToList()),
                                           new EnvelopesApi.ListStatusOptions()
            {
                fromDate = DateTime.UtcNow.AddHours(-1).ToString("o")
            }));
        }
Beispiel #2
0
        public EnvelopeSummary GenerateDocument(string name, string email)
        {
            var docuSignClient = new DocuSignClient(this.DocuSignCredentials);
            var accountId      = docuSignClient.AccountId;

            //get TAB's (requiredFields) from document
            TemplatesApi     templateInstanceApi = new TemplatesApi();
            EnvelopeTemplate templateBase        = templateInstanceApi.Get(accountId, this.DocuSignTemplate.TemplateId);

            Tabs requiredFields = new Tabs();

            if (templateBase != null && templateBase.Recipients != null && templateBase.Recipients.Signers.Any())
            {
                requiredFields = templateBase.Recipients.Signers.FirstOrDefault().Tabs;
            }

            // 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.
            List <TemplateRole> templateRoles = this.DocuSignTemplate.TemplateRoleNames.Select(m => new TemplateRole
            {
                Email    = email,
                Name     = name,
                RoleName = m,
                Tabs     = requiredFields
            }).ToList();

            // create a new envelope which we will use to send the signature request
            EnvelopeDefinition 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();

            return(envelopesApi.CreateEnvelope(accountId, envelope));
        }