Automate DocuSign Integration Tasks from PowerShell
The CData ADO.NET Provider for DocuSign is a standard ADO.NET Provider that make it easy to accomplish data cleansing, normalization, backup, and other integration tasks by enabling real-time access to DocuSign.
ADO.NET Provider
The ADO.NET Provider provides a SQL interface for DocuSign; this tutorial shows how to use the Provider to retrieve DocuSign data.
Once you have acquired the necessary connection properties, accessing DocuSign data in PowerShell can be enabled in three steps.
To connect to DocuSign, set the following connection properties:
- UseSandbox: indicates whether current user account is sandbox or not (FALSE by default)
- AccountId (optional): set it in the connection string if you have access to multiple Account Ids
Authenticating to DocuSign
DocuSign uses the OAuth authentication standard. To authenticate using OAuth, create an app to obtain the OAuthClientId, OAuthClientSecret, and CallbackURL connection properties. See the Help documentation more information.
-
Load the provider's assembly:
[Reflection.Assembly]::LoadFile("C:\Program Files\CData\CData ADO.NET Provider for DocuSign\lib\System.Data.CData.DocuSign.dll") -
Connect to DocuSign:
$conn= New-Object System.Data.CData.DocuSign.DocuSignConnection("OAuthClientId=MyClientId; OAuthClientSecret=MyClientSecret; CallbackURL=http://localhost:33333; ") $conn.Open() -
Instantiate the DocuSignDataAdapter, execute an SQL query, and output the results:
$sql="SELECT DocumentId, DocumentName from Documents" $da= New-Object System.Data.CData.DocuSign.DocuSignDataAdapter($sql, $conn) $dt= New-Object System.Data.DataTable $da.Fill($dt) $dt.Rows | foreach { Write-Host $_.documentid $_.documentname }