public void RecipientsEndToEndTest() { var envelope = new Envelope { Login = _account }; byte[] doc1 = { 36, 45, 34, 67, 121, 87, 99, 32, 32, 32, 54, 54, 55, 56, 32 }; var signers = new List<Signer>(); var ccs = new List<Signer>(); signers.Add(new Signer { email = "*****@*****.**", name = "test2", recipientId = "1", routingOrder = "1" }); ccs.Add(new Signer { email = _account.Email, name = _account.AccountName, recipientId = "2", routingOrder = "2" }); envelope.Recipients = new Recipients { signers = signers.ToArray(), carbonCopies = ccs.ToArray() }; Assert.IsTrue(envelope.Create(doc1, "test-self-signed.doc")); Assert.IsNull(envelope.RestError); Assert.AreEqual(2, envelope.GetRecipientNames().Count()); // add more recipients signers.Clear(); ccs.Clear(); ccs.Add(new Signer { email = "*****@*****.**", name = "test2", recipientId = "3", routingOrder = "4" }); signers.Add(new Signer { email = _account.Email, name = _account.AccountName, recipientId = "4", routingOrder = "3" }); Assert.IsTrue(envelope.AddRecipients(new Recipients { signers = signers.ToArray(), carbonCopies = ccs.ToArray() })); Assert.IsNull(envelope.RestError); Assert.AreEqual(4, envelope.GetRecipientNames().Count()); Assert.AreEqual((string)(envelope.GetFirstRecipients().First()["email"]), "*****@*****.**"); }
//========================================================================================== // *** Walkthrough #3 - Get Recipient Information //========================================================================================== private void GetEnvelopeRecipientInformation() { //***************************************************************** // ENTER VALUES FOR FOLLOWING VARIABLES! //***************************************************************** string AccountEmail = "***"; string AccountPassword = "******"; string EnvelopeId = "***"; //***************************************************************** // user credentials Account account = new Account(); account.Email = AccountEmail; account.Password = AccountPassword; // make the login call (retrieves your baseUrl and accountId) bool result = account.Login(); if (!result) { Console.WriteLine("Login API call failed for user {0}.\nError Code: {1}\nMessage: {2}", account.Email, account.RestError.errorCode, account.RestError.message); return; } // create envelope object and assign login info Envelope envelope = new Envelope(); envelope.Login = account; // set the envelopeId for which we will retrieve recipient info from envelope.EnvelopeId = EnvelopeId; // Retrieve envelope recipient names var recipNames = envelope.GetRecipientNames(); if (envelope.RestError != null) { Console.WriteLine("Error code: {0}\nMessage: {1}", envelope.RestError.errorCode, envelope.RestError.message); return; } Console.WriteLine("Envelope contains following recipients:\n"); foreach (var name in recipNames) { Console.WriteLine("\t{0}", name); } }