Exemple #1
0
        public bool checkAccountForTemplate()
        {
            bool retval = false;

            Signing.AccountCredentials                   creds = base.GetAPICredentials();
            Signing.DocuSignWeb.APIServiceSoap           api   = Signing.Envelope.CreateApiProxy(creds);
            Signing.DocuSignWeb.RequestTemplatesResponse response;
            Signing.DocuSignWeb.RequestTemplatesRequest  request = new Signing.DocuSignWeb.RequestTemplatesRequest();
            request.AccountID = (string)Session["AccountID"];
            request.IncludeAdvancedTemplates = true;
            try
            {
                response = api.RequestTemplates(request);
                foreach (Signing.DocuSignWeb.EnvelopeTemplateDefinition def in response.RequestTemplatesResult)
                {
                    if (def.Name == "InsuranceCo Auto Insurance Application")
                    {
                        Session["TemplateID"] = def.TemplateID;
                        retval = true;
                    }
                }
            }
            catch (Exception excp)
            {
                base.GoToErrorPage(excp.Message);
            }
            return(retval);
        }
 public static Envelope CreateEnvelopeFromServerTemplates(
     AccountCredentials accountCredentials,
     TemplateReference[] templateRefs,
     Recipient[] signers,
     EnvelopeInformation envelopeInfo,
     bool ActivateEnvelope)
 {
     DocuSignWeb.APIServiceSoap apiService = CreateApiProxy(accountCredentials);
     DocuSignWeb.EnvelopeStatus envStatus  = apiService.CreateEnvelopeFromTemplates(
         templateRefs, signers, envelopeInfo, ActivateEnvelope);
     return(new Envelope(envStatus.EnvelopeID, accountCredentials));
 }
        /// <summary>
        /// Initial method / factory instanciation.
        /// In case the call is successfully completed you will get back an
        /// envelope object that can be used to work with this envelope.
        /// In case the envelope is misconstructed an exception will be thrown
        /// The IDs on both the recipients and documents are going to be altered
        /// after the call and the Tabs will be linked to the appropriate document and
        /// recipient ids.
        /// </summary>
        /// <param name="signers">A collection of signer objects that describes who is going to
        /// recieve the documents.  You should have at least one signer.  Every signer
        /// must have at least one signature.</param>
        /// <param name="documents">A set of documents with tabs attached
        /// to them.  There should be at least one document in the envelope and there should be
        /// at least one tab on the envelope.</param>
        /// <param name="subject">Subject of the e-mail that the signers
        /// are going to receive</param>
        /// <param name="emailBlurb">e-mail blurb that will be inserted
        /// into the messages delivered to signers</param>
        /// <returns>An envelope object that can be used to work with this envelope.</returns>
        public static Envelope CreateEnvelopeFromTemplates(AccountCredentials accountCredentials,
                                                           DocuSignWeb.Recipient[] signers,
                                                           LinkedTemplateReferenceRoleAssignment[] roleAssignments,
                                                           string template,
                                                           string subject, string emailBlurb,
                                                           DocuSignWeb.CustomField[] fields)
        {
            //
            // Assign sequential IDs to all the recipients
            //
            int nextRecipientId = 1;

            foreach (DocuSignWeb.Recipient recipient in signers)
            {
                recipient.ID = nextRecipientId.ToString(System.Globalization.CultureInfo.InvariantCulture);
                nextRecipientId++;
            }

            //
            // update the template references
            //
            TemplateReferenceRoleAssignment[] finalRoleAssignments = new TemplateReferenceRoleAssignment[roleAssignments.Length];
            for (int i = 0; i < roleAssignments.Length; ++i)
            {
                roleAssignments[i].referenceRoleAssignment.RecipientID = roleAssignments[i].signer.ID;
                finalRoleAssignments[i] = roleAssignments[i].referenceRoleAssignment;
            }

            //
            // setting up the template
            //
            TemplateReference templateReference = new TemplateReference();

            templateReference.Template         = template;
            templateReference.TemplateLocation = TemplateLocationCode.SOAP;
            templateReference.RoleAssignments  = finalRoleAssignments;

            //
            // Envelope wide information
            //
            DocuSignWeb.EnvelopeInformation envelopeInfo = new EnvelopeInformation();
            envelopeInfo.AccountId    = accountCredentials.AccountId;
            envelopeInfo.CustomFields = fields;
            envelopeInfo.EmailBlurb   = emailBlurb;
            envelopeInfo.Subject      = subject;

            DocuSignWeb.APIServiceSoap apiService = CreateApiProxy(accountCredentials);
            DocuSignWeb.EnvelopeStatus envStatus  = apiService.CreateEnvelopeFromTemplates(
                new TemplateReference[] { templateReference },
                signers, envelopeInfo, true);
            return(new Envelope(envStatus.EnvelopeID, accountCredentials));
        }
Exemple #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="accountCredentials"></param>
        /// <returns>A disposable object you should wrap in using() statement</returns>
        private static DocuSignWeb.APIServiceWse CreateApiProxy(AccountCredentials accountCredentials)
        {
            // the envelope is finally constructed we are ready to send it in
            APIServiceWse apiService = new APIServiceWse();

            apiService.Url = accountCredentials.ApiUrl;
            // This sets the security policy as defined in wse3policyCache.config

            apiService.SetPolicy("UserNamePolicy");


            // or if your account is setup for cert security

            //apiService.SetPolicy("DocuSignCertificateLevelSecurity");

            // or you could set it up in code like this

            /*
             *
             *  DocuSignCertificateLevelSecurityAssertion assertion = new DocuSignCertificateLevelSecurityAssertion();
             *
             *  assertion.username = ConfigurationManager.AppSettings["Username"];
             *
             *  assertion.password = ConfigurationManager.AppSettings["Password"];
             *
             *  assertion.storeLocation = (System.Security.Cryptography.X509Certificates.StoreLocation) Enum.Parse(typeof(System.Security.Cryptography.X509Certificates.StoreLocation),ConfigurationManager.AppSettings["CertificateStoreLocation"]);
             *
             *  assertion.storeName = (System.Security.Cryptography.X509Certificates.StoreName) Enum.Parse(typeof(System.Security.Cryptography.X509Certificates.StoreName),ConfigurationManager.AppSettings["CertificateStoreName"]);
             *
             *  assertion.findByType = (System.Security.Cryptography.X509Certificates.X509FindType) Enum.Parse(typeof(System.Security.Cryptography.X509Certificates.X509FindType),ConfigurationManager.AppSettings["CertificateFindByType"]);
             *
             *  assertion.findByValue =  ConfigurationManager.AppSettings["CertificateFindByValue"];
             *
             *
             *  Microsoft.Web.Services3.Design.Policy policy = new Microsoft.Web.Services3.Design.Policy();
             *
             *  policy.Assertions.Add(assertion);
             *
             *
             *  api.SetPolicy(policy);
             *
             */


            return(apiService);
        }
    public AccountCredentials GetAPICredentials()
    {
        AccountCredentials credentials = new AccountCredentials();
        if (SettingIsSet("TransactionAPIUrl") && Session["AccountID"] != null && Session["APILogin"] != null && Session["Password"] != null)
        {
            credentials.AccountId = (string)Session["AccountID"];
            credentials.UserName = (string)Session["APILogin"];
            credentials.Password = (string)Session["Password"];
            credentials.ApiUrl = ConfigurationManager.AppSettings["TransactionAPIUrl"];

        }
        else
        {
            this.GoToErrorPage("Please make sure your credentials are entered in web.config");
        }
        return credentials;
    }
    public AccountCredentials GetAPICredentials()
    {
        AccountCredentials credentials = new AccountCredentials();

        if (SettingIsSet("IntegratorsKey") && SettingIsSet("APIAccountId") && SettingIsSet("APIUrl") && SettingIsSet("APIUserEmail") && SettingIsSet("Password"))
        {
            credentials.UserName = "******" + ConfigurationManager.AppSettings["IntegratorsKey"] + "]";
            credentials.UserName += ConfigurationManager.AppSettings["APIUserEmail"];
            credentials.Password = ConfigurationManager.AppSettings["Password"];
            credentials.AccountId = ConfigurationManager.AppSettings["APIAccountId"];
            credentials.ApiUrl = ConfigurationManager.AppSettings["APIUrl"];
        }
        else
        {
            GoToErrorPage("ENTERCREDS");
        }

        return credentials;
    }
Exemple #7
0
        public bool uploadTemplateToAccount()
        {
            bool retval = false;

            Signing.AccountCredentials         creds = base.GetAPICredentials();
            Signing.DocuSignWeb.APIServiceSoap api   = Signing.Envelope.CreateApiProxy(creds);

            string templateXml = System.IO.File.ReadAllText(Server.MapPath("resources/autoInsuranceApplication.dpd"));


            try{
                // upload template
                Signing.DocuSignWeb.SaveTemplateResult uploadTemplateResponse = api.UploadTemplate(templateXml, (string)Session["AccountID"], false);
                // so, due to a bug we have to upload a template in the dpd format
                // and then download it from the server, which will cause it to be converted to the new format
                // and then upload it again so that we can use it. However, when we try to upload it we'll hit another
                // bug that prevents us from saving a template without an email address so we'll specify bogus email
                // and then update to the correct email address when we are ready to send the envelope.

                Signing.DocuSignWeb.EnvelopeTemplate retrievedTemplate = api.RequestTemplate(uploadTemplateResponse.TemplateID, true);

                // this is to work around a bug that prevents saving a template when there isn't an email address specified.
                retrievedTemplate.Envelope.Recipients[0].UserName = "******";
                retrievedTemplate.Envelope.Recipients[0].Email    = "*****@*****.**";

                Signing.DocuSignWeb.SaveTemplateResult saveResult = api.SaveTemplate(retrievedTemplate);

                Session["TemplateID"] = saveResult.TemplateID;
                retval = true;
            } catch (Exception excp) {
                if (excp.Message.IndexOf("User lacks sufficient permissions") > 0)
                {
                    // set local error message and stay on page
                    lblTemplateUploadError.Text = "You do not have permissions to upload templates to this account. Please select a different account.";
                }
                else
                {
                    base.GoToErrorPage(excp.Message);
                }
            }
            return(retval);
        }
Exemple #8
0
        public CredentialService.Account[] checkAccountsForTemplatePermissions(CredentialService.LoginResult loginResult)
        {
            List <CredentialService.Account> accountsWithTemplatesPermissions = new List <InsuranceCo.CredentialService.Account>();

            Signing.AccountCredentials         creds = base.GetAPICredentials();
            Signing.DocuSignWeb.APIServiceSoap api   = Signing.Envelope.CreateApiProxy(creds);

            Signing.DocuSignWeb.RequestTemplatesResponse response;
            Signing.DocuSignWeb.RequestTemplatesRequest  request = new Signing.DocuSignWeb.RequestTemplatesRequest();

            foreach (CredentialService.Account account in loginResult.Accounts)
            {
                request.AccountID = account.AccountID;
                request.IncludeAdvancedTemplates = true;
                try{
                    response = api.RequestTemplates(request);
                    accountsWithTemplatesPermissions.Add(account);
                }
                catch (Exception excp) {
                    // nada
                }
            }
            return(accountsWithTemplatesPermissions.ToArray());
        }
        /// <summary>
        /// Initial method / factory instanciation.
        /// In case the call is successfully completed you will get back an 
        /// envelope object that can be used to work with this envelope.
        /// In case the envelope is misconstructed an exception will be thrown
        /// The IDs on both the recipients and documents are going to be altered
        /// after the call and the Tabs will be linked to the appropriate document and 
        /// recipient ids.
        /// </summary>
        /// <param name="signers">A collection of signer objects that describes who is going to 
        /// recieve the documents.  You should have at least one signer.  Every signer
        /// must have at least one signature.</param>
        /// <param name="documents">A set of documents with tabs attached
        /// to them.  There should be at least one document in the envelope and there should be
        /// at least one tab on the envelope.</param>
        /// <param name="subject">Subject of the e-mail that the signers
        /// are going to receive</param>
        /// <param name="emailBlurb">e-mail blurb that will be inserted
        /// into the messages delivered to signers</param>
        /// <returns>An envelope object that can be used to work with this envelope.</returns>
        public static Envelope CreateEnvelopeFromTemplates(AccountCredentials accountCredentials,
            DocuSignWeb.Recipient[] signers,
            LinkedTemplateReferenceRoleAssignment[] roleAssignments,
            string template,
            string subject, string emailBlurb,
            DocuSignWeb.CustomField[] fields)
        {
            //
            // Assign sequential IDs to all the recipients
            //
            int nextRecipientId = 1;
            foreach (DocuSignWeb.Recipient recipient in signers)
            {
                recipient.ID = nextRecipientId.ToString(System.Globalization.CultureInfo.InvariantCulture);
                nextRecipientId++;
            }

            //
            // update the template references
            //
            TemplateReferenceRoleAssignment[] finalRoleAssignments = new TemplateReferenceRoleAssignment[roleAssignments.Length];
            for( int i = 0; i < roleAssignments.Length; ++i)
            {
                roleAssignments[i].referenceRoleAssignment.RecipientID = roleAssignments[i].signer.ID;
                finalRoleAssignments[i] = roleAssignments[i].referenceRoleAssignment;
            }

            //
            // setting up the template
            //
            TemplateReference templateReference = new TemplateReference();
            templateReference.Template = template;
            templateReference.TemplateLocation = TemplateLocationCode.SOAP;
            templateReference.RoleAssignments = finalRoleAssignments;

            //
            // Envelope wide information
            //
            DocuSignWeb.EnvelopeInformation envelopeInfo = new EnvelopeInformation();
            envelopeInfo.AccountId = accountCredentials.AccountId;
            envelopeInfo.CustomFields = fields;
            envelopeInfo.EmailBlurb = emailBlurb;
            envelopeInfo.Subject = subject;

            DocuSignWeb.APIServiceSoap apiService = CreateApiProxy(accountCredentials);
            DocuSignWeb.EnvelopeStatus envStatus = apiService.CreateEnvelopeFromTemplates(
                new TemplateReference[] { templateReference },
                signers, envelopeInfo, true);
            return new Envelope(envStatus.EnvelopeID, accountCredentials);
        }
 /// <summary>
 /// Initial method / factory instanciation.
 /// In case the call is successfully completed you will get back an 
 /// envelope object that can be used to work with this envelope.
 /// In case the envelope is misconstructed an exception will be thrown
 /// The IDs on both the recipients and documents are going to be altered
 /// after the call and the Tabs will be linked to the appropriate document and 
 /// recipient ids.
 /// </summary>
 /// <param name="signers">A collection of signer objects that describes who is going to 
 /// recieve the documents.  You should have at least one signer.  Every signer
 /// must have at least one signature.</param>
 /// <param name="documents">A set of documents with tabs attached
 /// to them.  There should be at least one document in the envelope and there should be
 /// at least one tab on the envelope.</param>
 /// <param name="subject">Subject of the e-mail that the signers
 /// are going to receive</param>
 /// <param name="emailBlurb">e-mail blurb that will be inserted
 /// into the messages delivered to signers</param>
 /// <returns>An envelope object that can be used to work with this envelope.</returns>
 public static Envelope CreateAndSendEnvelope(AccountCredentials accountCredentials, DocuSignWeb.Recipient[] signers, LinkedDocument[] documents, string subject, string emailBlurb, DocuSignWeb.CustomField[] fields)
 {
     return CreateAndSendEnvelope(accountCredentials, signers, documents, subject, emailBlurb, fields, null);
 }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="accountCredentials"></param>
        /// <returns>A disposable object you should wrap in using() statement</returns>
        private static DocuSignWeb.APIServiceWse CreateApiProxy(AccountCredentials accountCredentials)
        {
            // the envelope is finally constructed we are ready to send it in
            APIServiceWse apiService = new APIServiceWse();
            apiService.Url = accountCredentials.ApiUrl;
            // This sets the security policy as defined in wse3policyCache.config

            apiService.SetPolicy("UserNamePolicy");

            // or if your account is setup for cert security

            //apiService.SetPolicy("DocuSignCertificateLevelSecurity");

            // or you could set it up in code like this

            /*

                DocuSignCertificateLevelSecurityAssertion assertion = new DocuSignCertificateLevelSecurityAssertion();

                assertion.username = ConfigurationManager.AppSettings["Username"];

                assertion.password = ConfigurationManager.AppSettings["Password"];

                assertion.storeLocation = (System.Security.Cryptography.X509Certificates.StoreLocation) Enum.Parse(typeof(System.Security.Cryptography.X509Certificates.StoreLocation),ConfigurationManager.AppSettings["CertificateStoreLocation"]);

                assertion.storeName = (System.Security.Cryptography.X509Certificates.StoreName) Enum.Parse(typeof(System.Security.Cryptography.X509Certificates.StoreName),ConfigurationManager.AppSettings["CertificateStoreName"]);

                assertion.findByType = (System.Security.Cryptography.X509Certificates.X509FindType) Enum.Parse(typeof(System.Security.Cryptography.X509Certificates.X509FindType),ConfigurationManager.AppSettings["CertificateFindByType"]);

                assertion.findByValue =  ConfigurationManager.AppSettings["CertificateFindByValue"];

                Microsoft.Web.Services3.Design.Policy policy = new Microsoft.Web.Services3.Design.Policy();

                policy.Assertions.Add(assertion);

                api.SetPolicy(policy);

            */

            return apiService;
        }
Exemple #12
0
        /// <summary>
        /// Initial method / factory instanciation.
        /// In case the call is successfully completed you will get back an
        /// envelope object that can be used to work with this envelope.
        /// In case the envelope is misconstructed an exception will be thrown
        /// The IDs on both the recipients and documents are going to be altered
        /// after the call and the Tabs will be linked to the appropriate document and
        /// recipient ids.
        /// </summary>
        /// <param name="signers">A collection of signer objects that describes who is going to
        /// recieve the documents.  You should have at least one signer.  Every signer
        /// must have at least one signature.</param>
        /// <param name="documents">A set of documents with tabs attached
        /// to them.  There should be at least one document in the envelope and there should be
        /// at least one tab on the envelope.</param>
        /// <param name="subject">Subject of the e-mail that the signers
        /// are going to receive</param>
        /// <param name="emailBlurb">e-mail blurb that will be inserted
        /// into the messages delivered to signers</param>
        /// <returns>An envelope object that can be used to work with this envelope.</returns>
        public static Envelope CreateAndSendEnvelope(AccountCredentials accountCredentials, DocuSignWeb.Recipient[] signers, LinkedDocument[] documents, string subject, string emailBlurb, DocuSignWeb.CustomField[] fields, DocuSignWeb.Attachment[] attachments)
        {
            //
            // Assign sequential IDs to all the recipients
            //
            int nextRecipientId = 1;

            foreach (DocuSignWeb.Recipient recipient in signers)
            {
                recipient.ID = nextRecipientId.ToString(System.Globalization.CultureInfo.InvariantCulture);
                nextRecipientId++;
            }

            //
            // go through the documents
            // assign them appropriate IDs
            // and then pull out the tabs and properly assign
            // recipients to for them.
            //
            List <DocuSignWeb.Tab> tabs = new List <DocuSignWeb.Tab>();
            int nextDocId = 1;

            foreach (LinkedDocument linkedDoc in documents)
            {
                linkedDoc.Document.ID = nextDocId.ToString(CultureInfo.InvariantCulture);

                foreach (LinkedTab linkedTab in linkedDoc.Tabs)
                {
                    linkedTab.Tab.DocumentID  = linkedDoc.Document.ID;
                    linkedTab.Tab.RecipientID = linkedTab.Recipient.ID;
                    tabs.Add(linkedTab.Tab);
                }
                nextDocId++;
            }

            //
            // Envelope wide initialization
            //
            DocuSignWeb.Envelope envelope = new DocuSignWeb.Envelope();
            envelope.Subject    = subject;
            envelope.EmailBlurb = emailBlurb;
            envelope.Recipients = signers;
            envelope.AccountId  = accountCredentials.AccountId;

            // assign the document array
            envelope.Documents = new DocuSignWeb.Document[documents.Length];
            for (int i = 0; i < documents.Length; ++i)
            {
                envelope.Documents[i] = documents[i].Document;
            }

            // assign the tabs to the envelope
            envelope.Tabs = tabs.ToArray();

            envelope.CustomFields       = fields;
            envelope.EnvelopeAttachment = attachments;

            using (DocuSignWeb.APIServiceWse apiService = CreateApiProxy(accountCredentials))
            {
                DocuSignWeb.EnvelopeStatus envStatus = apiService.CreateAndSendEnvelope(envelope);
                return(new Envelope(envStatus.EnvelopeID, accountCredentials));
            }
        }
        /// <summary>
        /// Initial method / factory instanciation.
        /// In case the call is successfully completed you will get back an 
        /// envelope object that can be used to work with this envelope.
        /// In case the envelope is misconstructed an exception will be thrown
        /// The IDs on both the recipients and documents are going to be altered
        /// after the call and the Tabs will be linked to the appropriate document and 
        /// recipient ids.
        /// </summary>
        /// <param name="signers">A collection of signer objects that describes who is going to 
        /// recieve the documents.  You should have at least one signer.  Every signer
        /// must have at least one signature.</param>
        /// <param name="documents">A set of documents with tabs attached
        /// to them.  There should be at least one document in the envelope and there should be
        /// at least one tab on the envelope.</param>
        /// <param name="subject">Subject of the e-mail that the signers
        /// are going to receive</param>
        /// <param name="emailBlurb">e-mail blurb that will be inserted
        /// into the messages delivered to signers</param>
        /// <returns>An envelope object that can be used to work with this envelope.</returns>
        public static Envelope CreateAndSendEnvelope(AccountCredentials accountCredentials, DocuSignWeb.Recipient[] signers, LinkedDocument[] documents, string subject, string emailBlurb, DocuSignWeb.CustomField[] fields, DocuSignWeb.Attachment[] attachments)
        {
            //
            // Assign sequential IDs to all the recipients
            //
            int nextRecipientId = 1;
            foreach (DocuSignWeb.Recipient recipient in signers)
            {
                recipient.ID = nextRecipientId.ToString(System.Globalization.CultureInfo.InvariantCulture);
                nextRecipientId++;
            }

            //
            // go through the documents
            // assign them appropriate IDs
            // and then pull out the tabs and properly assign
            // recipients to for them.
            //
            List<DocuSignWeb.Tab> tabs = new List<DocuSignWeb.Tab>();
            int nextDocId = 1;
            foreach (LinkedDocument linkedDoc in documents)
            {
                linkedDoc.Document.ID = nextDocId.ToString(CultureInfo.InvariantCulture);

                foreach (LinkedTab linkedTab in linkedDoc.Tabs)
                {
                    linkedTab.Tab.DocumentID = linkedDoc.Document.ID;
                    linkedTab.Tab.RecipientID = linkedTab.Recipient.ID;
                    tabs.Add(linkedTab.Tab);
                }
                nextDocId++;
            }

            //
            // Envelope wide initialization
            //
            DocuSignWeb.Envelope envelope = new DocuSignWeb.Envelope();
            envelope.Subject = subject;
            envelope.EmailBlurb = emailBlurb;
            envelope.Recipients = signers;
            envelope.AccountId = accountCredentials.AccountId;

            // assign the document array
            envelope.Documents = new DocuSignWeb.Document[documents.Length];
            for (int i = 0; i < documents.Length; ++i)
            {
                envelope.Documents[i] = documents[i].Document;
            }

            // assign the tabs to the envelope
            envelope.Tabs = tabs.ToArray();

            envelope.CustomFields = fields;
            envelope.EnvelopeAttachment = attachments;

            DocuSignWeb.APIServiceSoap apiService = CreateApiProxy(accountCredentials);
            DocuSignWeb.EnvelopeStatus envStatus = apiService.CreateAndSendEnvelope(envelope);
            return new Envelope(envStatus.EnvelopeID, accountCredentials);
        }
Exemple #14
0
 /// <summary>
 /// Initial method / factory instanciation.
 /// In case the call is successfully completed you will get back an
 /// envelope object that can be used to work with this envelope.
 /// In case the envelope is misconstructed an exception will be thrown
 /// The IDs on both the recipients and documents are going to be altered
 /// after the call and the Tabs will be linked to the appropriate document and
 /// recipient ids.
 /// </summary>
 /// <param name="signers">A collection of signer objects that describes who is going to
 /// recieve the documents.  You should have at least one signer.  Every signer
 /// must have at least one signature.</param>
 /// <param name="documents">A set of documents with tabs attached
 /// to them.  There should be at least one document in the envelope and there should be
 /// at least one tab on the envelope.</param>
 /// <param name="subject">Subject of the e-mail that the signers
 /// are going to receive</param>
 /// <param name="emailBlurb">e-mail blurb that will be inserted
 /// into the messages delivered to signers</param>
 /// <returns>An envelope object that can be used to work with this envelope.</returns>
 public static Envelope CreateAndSendEnvelope(AccountCredentials accountCredentials, DocuSignWeb.Recipient[] signers, LinkedDocument[] documents, string subject, string emailBlurb, DocuSignWeb.CustomField[] fields)
 {
     return(CreateAndSendEnvelope(accountCredentials, signers, documents, subject, emailBlurb, fields, null));
 }
Exemple #15
0
 /// <summary>
 /// A way to create an envelope that has already been instantiated in DocuSign via
 /// "CreateAndSend" API.
 /// </summary>
 /// <param name="envelopeId">existing Envelope ID</param>
 /// <param name="accountCredentials">Account Credentials so subsequent calls are valid</param>
 public Envelope(string envelopeId, AccountCredentials accountCredentials)
 {
     _envelopeId         = envelopeId;
     _accountCredentials = accountCredentials;
 }
 /// <summary>
 /// A way to create an envelope that has already been instantiated in DocuSign via
 /// "CreateAndSend" API.
 /// </summary>
 /// <param name="envelopeId">existing Envelope ID</param>
 /// <param name="accountCredentials">Account Credentials so subsequent calls are valid</param>
 public Envelope(string envelopeId, AccountCredentials accountCredentials)
 {
     _envelopeId = envelopeId;
     _accountCredentials = accountCredentials;
 }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="accountCredentials"></param>
        /// <returns>A disposable object you should wrap in using() statement</returns>
        public static DocuSignWeb.APIServiceSoap CreateApiProxy(AccountCredentials accountCredentials)
        {
            #if true
            // the envelope is finally constructed we are ready to send it in
            DocuSignWeb.APIServiceSoapClient apiService = new DocuSignWeb.APIServiceSoapClient("APIServiceSoap", accountCredentials.ApiUrl);

            apiService.ClientCredentials.UserName.UserName = accountCredentials.UserName;
            apiService.ClientCredentials.UserName.Password = accountCredentials.Password;

            return apiService;

            #else       // this is a security token configuration
            // this is required for certain calls like RequestRecipientToken
            // you need to get a certificate from Thawte or VeriSign first and install it
            DocuSignWeb.APIServiceSoapClient apiService = new DocuSignWeb.APIServiceSoapClient("APIServiceSoap1", accountCredentials.ApiUrl);
            apiService.ClientCredentials.UserName.UserName = "******"+ConfigurationManager.AppSettings["IntegratorsKey"]+"]"+ConfigurationManager.AppSettings["APIUserEmail"];
            apiService.ClientCredentials.UserName.Password = ConfigurationManager.AppSettings["Password"];

            //
            // need to add the supporting token since DocuSign uses dual authentication for
            // for critical calls
            CustomBinding binding = (CustomBinding)apiService.Endpoint.Binding;
            BindingElementCollection elements = binding.CreateBindingElements();
            SecurityBindingElement security = elements.Find<SecurityBindingElement>();
            UserNameSecurityTokenParameters tokenParameters = new UserNameSecurityTokenParameters();
            tokenParameters.InclusionMode = SecurityTokenInclusionMode.AlwaysToRecipient;
            tokenParameters.RequireDerivedKeys = false;
            security.EndpointSupportingTokenParameters.SignedEncrypted.Add(
              tokenParameters);
            apiService.Endpoint.Binding = new CustomBinding(elements.ToArray()); ;
            return apiService;
            #endif
        }
 public static Envelope CreateEnvelopeFromServerTemplates(
     AccountCredentials accountCredentials,
     TemplateReference[] templateRefs,
     Recipient[] signers,
     EnvelopeInformation envelopeInfo,
     bool ActivateEnvelope)
 {
     DocuSignWeb.APIServiceSoap apiService = CreateApiProxy(accountCredentials);
     DocuSignWeb.EnvelopeStatus envStatus = apiService.CreateEnvelopeFromTemplates(
         templateRefs, signers, envelopeInfo, ActivateEnvelope);
     return new Envelope(envStatus.EnvelopeID, accountCredentials);
 }