![]() |
VOOZH | about |
The CData Cmdlets for Salesforce Data Cloud are standard PowerShell cmdlets that make it easy to accomplish data cleansing, normalization, backup, and other integration tasks by enabling real-time access to Salesforce Data Cloud.
The Cmdlets are not only a PowerShell interface to Salesforce Data Cloud, but also an SQL interface; this tutorial shows how to use both to retrieve Salesforce Data Cloud data. We also show examples of the ADO.NET equivalent, which is possible with the CData ADO.NET Provider for Salesforce Data Cloud. To access Salesforce Data Cloud data from other .NET applications, like LINQPad, use the CData ADO.NET Provider for Salesforce Data Cloud.
Once you have acquired the necessary connection properties, accessing Salesforce Data Cloud data in PowerShell can be enabled in three steps.
Salesforce Data Cloud supports authentication via the OAuth standard.
Set to OAuth.
CData provides an embedded OAuth application that simplifies authentication at the desktop.
You can also authenticate from the desktop via a custom OAuth application, which you configure and register at the Salesforce Data Cloud console. For further information, see Creating a Custom OAuth App in the Help documentation.
Before you connect, set these properties:
When you connect, the driver opens Salesforce Data Cloud's OAuth endpoint in your default browser. Log in and grant permissions to the application.
The driver then completes the OAuth process as follows:
For other OAuth methods, including Web Applications and Headless Machines, refer to the Help documentation.
Install the module:
Install-Module SalesforceDataCloudCmdlets
Connect:
$salesforcedatacloud = Connect-SalesforceDataCloud -InitiateOAuth "$InitiateOAuth"
Search for and retrieve data:
$employeecount = "250" $account = Select-SalesforceDataCloud -Connection $salesforcedatacloud -Table "Account" -Where "EmployeeCount = `'$EmployeeCount`'" $account
You can also use the Invoke-SalesforceDataCloud cmdlet to execute SQL commands:
$account = Invoke-SalesforceDataCloud -Connection $salesforcedatacloud -Query 'SELECT * FROM Account WHERE EmployeeCount = @EmployeeCount' -Params @{'@EmployeeCount'='250'}
Load the provider's assembly:
[Reflection.Assembly]::LoadFile("C:\Program Files\CData\CData ADO.NET Provider for Salesforce Data Cloud\lib\System.Data.CData.SalesforceDataCloud.dll")
Connect to Salesforce Data Cloud:
$conn= New-Object System.Data.CData.SalesforceDataCloud.SalesforceDataCloudConnection("InitiateOAuth=GETANDREFRESH;")
$conn.Open()
Instantiate the SalesforceDataCloudDataAdapter, execute an SQL query, and output the results:
$sql="SELECT [Account ID], [Account Name] from Account"
$da= New-Object System.Data.CData.SalesforceDataCloud.SalesforceDataCloudDataAdapter($sql, $conn)
$dt= New-Object System.Data.DataTable
$da.Fill($dt)
$dt.Rows | foreach {
Write-Host $_.[account id] $_.[account name]
}
Download a free trial of the Salesforce Data Cloud Data Provider to get started:
Download NowLearn more:
👁 Salesforce Data Cloud IconRapidly create and deploy powerful .NET applications that integrate with Salesforce Data Cloud.