![]() |
VOOZH | about |
The CData Cmdlets for Zoho Creator are standard PowerShell cmdlets that make it easy to accomplish data cleansing, normalization, backup, and other integration tasks by enabling real-time and bidirectional access to Zoho Creator.
The Cmdlets are not only a PowerShell interface to Zoho Creator, but also an SQL interface; this tutorial shows how to use both to create, retrieve, update, and delete Zoho Creator data. We also show examples of the ADO.NET equivalent, which is possible with the CData ADO.NET Provider for Zoho Creator. To access Zoho Creator data from other .NET applications, like LINQPad, use the CData ADO.NET Provider for Zoho Creator.
Once you have acquired the necessary connection properties, accessing Zoho Creator data in PowerShell can be enabled in three steps.
The connector is already registered with Zoho Creator as an OAuth application.
If you would prefer to use your own custom OAuth app, see the Help documentation.
Install the module:
Install-Module ZohoCreatorCmdlets
Connect:
$zohocreator = Connect-ZohoCreator -AccountsServer "$AccountsServer" -InitiateOAuth "$InitiateOAuth"
Search for and retrieve data:
$leave_type = "Sick" $leave_types = Select-ZohoCreator -Connection $zohocreator -Table "Leave_Types" -Where "Leave_Type = `'$Leave_Type`'" $leave_types
You can also use the Invoke-ZohoCreator cmdlet to execute SQL commands:
$leave_types = Invoke-ZohoCreator -Connection $zohocreator -Query 'SELECT * FROM Leave_Types WHERE Leave_Type = @Leave_Type' -Params @{'@Leave_Type'='Sick'}
Load the provider's assembly:
[Reflection.Assembly]::LoadFile("C:\Program Files\CData\CData ADO.NET Provider for Zoho Creator\lib\System.Data.CData.ZohoCreator.dll")
Connect to Zoho Creator:
$conn= New-Object System.Data.CData.ZohoCreator.ZohoCreatorConnection("AccountsServer=AccountsServer;InitiateOAuth=GETANDREFRESH;")
$conn.Open()
Instantiate the ZohoCreatorDataAdapter, execute an SQL query, and output the results:
$sql="SELECT ID, Leave_Type from Leave_Types"
$da= New-Object System.Data.CData.ZohoCreator.ZohoCreatorDataAdapter($sql, $conn)
$dt= New-Object System.Data.DataTable
$da.Fill($dt)
$dt.Rows | foreach {
Write-Host $_.id $_.leave_type
}
Update-ZohoCreator -Connection $ZohoCreator -Columns @('ID','Leave_Type') -Values @('MyID', 'MyLeave_Type') -Table Leave_Types -Id "MyId"
$cmd = New-Object System.Data.CData.ZohoCreator.ZohoCreatorCommand("UPDATE Leave_Types SET Leave_Type='Sick' WHERE Id = @myId", $conn)
$cmd.Parameters.Add((New-Object System.Data.CData.ZohoCreator.ZohoCreatorParameter("@myId","10456255-0015501366")))
$cmd.ExecuteNonQuery()
Add-ZohoCreator -Connection $ZohoCreator -Table Leave_Types -Columns @("ID", "Leave_Type") -Values @("MyID", "MyLeave_Type")
$cmd = New-Object System.Data.CData.ZohoCreator.ZohoCreatorCommand("INSERT INTO Leave_Types (Leave_Type) VALUES (@myLeave_Type)", $conn)
$cmd.Parameters.Add((New-Object System.Data.CData.ZohoCreator.ZohoCreatorParameter("@myLeave_Type","Sick")))
$cmd.ExecuteNonQuery()
Remove-ZohoCreator -Connection $ZohoCreator -Table "Leave_Types" -Id "MyId"
$cmd = New-Object System.Data.CData.ZohoCreator.ZohoCreatorCommand("DELETE FROM Leave_Types WHERE Id=@myId", $conn)
$cmd.Parameters.Add((New-Object System.Data.CData.ZohoCreator.ZohoCreatorParameter("@myId","001d000000YBRseAAH")))
$cmd.ExecuteNonQuery()
CodeProject
Download a free trial of the Zoho Creator Data Provider to get started:
Download NowLearn more:
👁 Zoho Creator IconRapidly create and deploy powerful .NET applications that integrate with Zoho Creator.