![]() |
VOOZH | about |
The CData Cmdlets for Reckon Accounts Hosted 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 Reckon Accounts Hosted.
The Cmdlets are not only a PowerShell interface to Reckon Accounts Hosted, but also an SQL interface; this tutorial shows how to use both to create, retrieve, update, and delete Reckon Accounts Hosted data. We also show examples of the ADO.NET equivalent, which is possible with the CData ADO.NET Provider for Reckon Accounts Hosted. To access Reckon Accounts Hosted data from other .NET applications, like LINQPad, use the CData ADO.NET Provider for Reckon Accounts Hosted.
Once you have acquired the necessary connection properties, accessing Reckon Accounts Hosted data in PowerShell can be enabled in three steps.
The connector makes requests to Reckon Accounts Hosted through OAuth. Specify the following connection properties:
CData provides an embedded OAuth application that simplifies OAuth desktop authentication. See the Help documentation for information on other OAuth authentication methods (web, headless, etc.), creating custom OAuth applications, and reasons for doing so.
Install the module:
Install-Module ReckonAccountsHostedCmdlets
Connect:
$reckonaccountshosted = Connect-ReckonAccountsHosted -SubscriptionKey "$SubscriptionKey" -CountryVersion "$CountryVersion" -CompanyFile "$CompanyFile" -User "$User" -Password "$Password" -CallbackURL "$CallbackURL" -OAuthClientId "$OAuthClientId" -OAuthClientSecret "$OAuthClientSecret" -InitiateOAuth "$InitiateOAuth"
Search for and retrieve data:
$isactive = "true" $accounts = Select-ReckonAccountsHosted -Connection $reckonaccountshosted -Table "Accounts" -Where "IsActive = `'$IsActive`'" $accounts
You can also use the Invoke-ReckonAccountsHosted cmdlet to execute SQL commands:
$accounts = Invoke-ReckonAccountsHosted -Connection $reckonaccountshosted -Query 'SELECT * FROM Accounts WHERE IsActive = @IsActive' -Params @{'@IsActive'='true'}
Load the provider's assembly:
[Reflection.Assembly]::LoadFile("C:\Program Files\CData\CData ADO.NET Provider for Reckon Accounts Hosted\lib\System.Data.CData.ReckonAccountsHosted.dll")
Connect to Reckon Accounts Hosted:
$conn= New-Object System.Data.CData.ReckonAccountsHosted.ReckonAccountsHostedConnection("SubscriptionKey=my_subscription_key;CountryVersion=2021.R2.AU;CompanyFile=Q:/CompanyName.QBW;User=my_user;Password=my_password;CallbackURL=http://localhost:33333;OAuthClientId=my_oauth_client_id;OAuthClientSecret=my_oauth_client_secret;InitiateOAuth=GETANDREFRESH;")
$conn.Open()
Instantiate the ReckonAccountsHostedDataAdapter, execute an SQL query, and output the results:
$sql="SELECT Name, Balance from Accounts"
$da= New-Object System.Data.CData.ReckonAccountsHosted.ReckonAccountsHostedDataAdapter($sql, $conn)
$dt= New-Object System.Data.DataTable
$da.Fill($dt)
$dt.Rows | foreach {
Write-Host $_.name $_.balance
}
Update-ReckonAccountsHosted -Connection $ReckonAccountsHosted -Columns @('Name','Balance') -Values @('MyName', 'MyBalance') -Table Accounts -Id "MyId"
$cmd = New-Object System.Data.CData.ReckonAccountsHosted.ReckonAccountsHostedCommand("UPDATE Accounts SET IsActive='true' WHERE Id = @myId", $conn)
$cmd.Parameters.Add((New-Object System.Data.CData.ReckonAccountsHosted.ReckonAccountsHostedParameter("@myId","10456255-0015501366")))
$cmd.ExecuteNonQuery()
Add-ReckonAccountsHosted -Connection $ReckonAccountsHosted -Table Accounts -Columns @("Name", "Balance") -Values @("MyName", "MyBalance")
$cmd = New-Object System.Data.CData.ReckonAccountsHosted.ReckonAccountsHostedCommand("INSERT INTO Accounts (IsActive) VALUES (@myIsActive)", $conn)
$cmd.Parameters.Add((New-Object System.Data.CData.ReckonAccountsHosted.ReckonAccountsHostedParameter("@myIsActive","true")))
$cmd.ExecuteNonQuery()
Remove-ReckonAccountsHosted -Connection $ReckonAccountsHosted -Table "Accounts" -Id "MyId"
$cmd = New-Object System.Data.CData.ReckonAccountsHosted.ReckonAccountsHostedCommand("DELETE FROM Accounts WHERE Id=@myId", $conn)
$cmd.Parameters.Add((New-Object System.Data.CData.ReckonAccountsHosted.ReckonAccountsHostedParameter("@myId","001d000000YBRseAAH")))
$cmd.ExecuteNonQuery()
CodeProject
Download a free trial of the Reckon Accounts Hosted Data Provider to get started:
Download NowLearn more:
👁 Reckon Accounts Hosted IconRapidly create and deploy powerful .NET applications that integrate with Reckon Accounts Hosted.