Skip to content

Instantly share code, notes, and snippets.

@Ergin008
Last active August 29, 2015 14:26
Show Gist options
  • Save Ergin008/9e5ce379e14c986e45cc to your computer and use it in GitHub Desktop.
Save Ergin008/9e5ce379e14c986e45cc to your computer and use it in GitHub Desktop.
Full code sample for DocuSign Request Signature Quickstart - uses open source NuGet Client: https://www.nuget.org/packages/DocuSign.Integration.Client.dll/
//
// DocuSign API Quickstart - Embedded Signing
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Diagnostics;
// install DocuSign NuGet package or download source from GitHub:
// https://www.nuget.org/packages/DocuSign.Integration.Client.dll/
using DocuSign.Integrations.Client;
namespace Quickstart_1
{
class RequestSignature
{
static void Main(string[] args)
{
//=======================================================================================================================
// STEP 1: Login API
//=======================================================================================================================
RestSettings.Instance.DocuSignAddress = "https://demo.docusign.net";
RestSettings.Instance.WebServiceUrl = RestSettings.Instance.DocuSignAddress + "/restapi/v2";
RestSettings.Instance.IntegratorKey = "INTEGRATOR_KEY";
Account account = new Account();
account.Email = "EMAIL";
account.Password = "PASSWORD";
// Login API 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);
Console.Read();
return;
}
//=======================================================================================================================
// STEP 2: Create and Send Envelope API
//=======================================================================================================================
// create envelope object and assign login info
Envelope envelope = new Envelope();
envelope.Login = account;
envelope.EmailSubject = "Please sign my document";
envelope.EmailBlurb = "This goes in the body of the email";
envelope.Recipients = new Recipients()
{
signers = new Signer[]
{
new Signer()
{
email = "RECIPIENT_EMAIL",
name = "RECIPIENT NAME",
routingOrder = "1",
recipientId = "1"
}
}
};
Tabs tabList = new Tabs()
{
signHereTabs = new Tab[]
{
new Tab()
{
documentId = 1,
pageNumber = 1,
xPosition = 100,
yPosition = 150
}
}
};
// assign our one signHere tab to the recipient
envelope.Recipients.signers[0].tabs = tabList;
// "sent" to send immediately, "created" to save as draft
envelope.Status = "sent";
//*** Specify document and send the signature request
result = envelope.Create("C:\\PATH\\TO\\DOCUMENT\\TEST.PDF");
Console.WriteLine("Signature request has been sent to {0}.", envelope.Recipients.signers[0].email);
Console.ReadLine(); // pause to show console output
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment