![]() |
VOOZH | about |
The CData Cmdlets for QuickBooks Time are standard PowerShell cmdlets that make it easy to accomplish data cleansing, normalization, backup, and other integration tasks by enabling real-time access to QuickBooks Time.
The Cmdlets are not only a PowerShell interface to QuickBooks Time, but also an SQL interface; this tutorial shows how to use both to retrieve QuickBooks Time data. We also show examples of the ADO.NET equivalent, which is possible with the CData ADO.NET Provider for QuickBooks Time. To access QuickBooks Time data from other .NET applications, like LINQPad, use the CData ADO.NET Provider for QuickBooks Time.
Once you have acquired the necessary connection properties, accessing QuickBooks Time data in PowerShell can be enabled in three steps.
TSheets uses the OAuth2 standard for authentication and authorization. To construct your own OAuth app and connect to data, refer to OAuth section in the Help.
Install the module:
Install-Module TSheetsCmdlets
Connect:
$tsheets = Connect-TSheets -OAuthClientId "$OAuthClientId" -OAuthClientSecret "$OAuthClientSecret" -CallbackUrl "$CallbackUrl" -InitiateOAuth "$InitiateOAuth"
Search for and retrieve data:
$jobcodetype = "regular" $timesheets = Select-TSheets -Connection $tsheets -Table "Timesheets" -Where "JobCodeType = `'$JobCodeType`'" $timesheets
You can also use the Invoke-TSheets cmdlet to execute SQL commands:
$timesheets = Invoke-TSheets -Connection $tsheets -Query 'SELECT * FROM Timesheets WHERE JobCodeType = @JobCodeType' -Params @{'@JobCodeType'='regular'}
Load the provider's assembly:
[Reflection.Assembly]::LoadFile("C:\Program Files\CData\CData ADO.NET Provider for QuickBooks Time\lib\System.Data.CData.TSheets.dll")
Connect to QuickBooks Time:
$conn= New-Object System.Data.CData.TSheets.TSheetsConnection("OAuthClientId=myclientid;OAuthClientSecret=myclientsecret;CallbackUrl=http://localhost:33333;InitiateOAuth=GETANDREFRESH;")
$conn.Open()
Instantiate the TSheetsDataAdapter, execute an SQL query, and output the results:
$sql="SELECT Id, JobcodeId from Timesheets"
$da= New-Object System.Data.CData.TSheets.TSheetsDataAdapter($sql, $conn)
$dt= New-Object System.Data.DataTable
$da.Fill($dt)
$dt.Rows | foreach {
Write-Host $_.id $_.jobcodeid
}
Download a free trial of the QuickBooks Time Data Provider to get started:
Download NowLearn more:
👁 QuickBooks Time IconRapidly create and deploy powerful .NET applications that integrate with QuickBooks Time.