Automate Highrise Integration Tasks from PowerShell

Ready to get started?

Download for a free trial:

Download Now

Learn more:

Highrise ADO.NET Provider

Rapidly create and deploy powerful .NET applications that integrate with Highrise account data including Accounts, Deals, Emails, People, Tasks, and more!



Are you looking for a quick and easy way to access Highrise data from PowerShell? We show how to use the Cmdlets for Highrise and the CData ADO.NET Provider for Highrise to connect to Highrise data and synchronize, automate, download, and more.

The CData Cmdlets for Highrise 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 Highrise.

Cmdlets or ADO.NET?

The cmdlets are not only a PowerShell interface to the Highrise API, but also an SQL interface; this tutorial shows how to use both to create, retrieve, update, and delete Highrise data. We also show examples of the ADO.NET equivalent, which is possible with the CData ADO.NET Provider for Highrise. To access Highrise data from other .NET applications, like LINQPad, use the CData ADO.NET Provider for Highrise.

After obtaining the needed connection properties, accessing Highrise data in PowerShell consists of three basic steps.

Highrise uses the OAuth authentication standard. To authenticate to Highrise, you will need to obtain the OAuthClientId, OAuthClientSecret, and CallbackURL by registering an app with Highrise. You will also need to set the AccountId to connect to data.

See the "Getting Started" section in the help documentation for a guide to using OAuth.

PowerShell

  1. Install the module:

    Install-Module HighriseCmdlets
  2. Connect:

    $highrise = Connect-Highrise -OAuthClientId "$OAuthClientId" -OAuthClientSecret "$OAuthClientSecret" -CallbackURL "$CallbackURL" -AccountId "$AccountId"
  3. Search for and retrieve data:

    $groupid = "MyGroupId" $deals = Select-Highrise -Connection $highrise -Table "Deals" -Where "GroupId = `'$GroupId`'" $deals

    You can also use the Invoke-Highrise cmdlet to execute SQL commands:

    $deals = Invoke-Highrise -Connection $highrise -Query 'SELECT * FROM Deals WHERE GroupId = @GroupId' -Params @{'@GroupId'='MyGroupId'}

ADO.NET

  1. Load the provider's assembly:

    [Reflection.Assembly]::LoadFile("C:\Program Files\CData\CData ADO.NET Provider for Highrise\lib\System.Data.CData.Highrise.dll")
  2. Connect to Highrise:

    $conn= New-Object System.Data.CData.Highrise.HighriseConnection("OAuthClientId=MyOAuthClientId;OAuthClientSecret=MyOAuthClientSecret;CallbackURL=http://localhost;AccountId=MyAccountId;InitiateOAuth=GETANDREFRESH") $conn.Open()
  3. Instantiate the HighriseDataAdapter, execute an SQL query, and output the results:

    $sql="SELECT Name, Price from Deals" $da= New-Object System.Data.CData.Highrise.HighriseDataAdapter($sql, $conn) $dt= New-Object System.Data.DataTable $da.Fill($dt) $dt.Rows | foreach { Write-Host $_.name $_.price }

Update Highrise Data

PowerShell

Update-Highrise -Connection $Highrise -Columns @('Name','Price') -Values @('MyName', 'MyPrice') -Table Deals -Id "MyId"

ADO.NET

$cmd = New-Object System.Data.CData.Highrise.HighriseCommand("UPDATE Deals SET GroupId='MyGroupId' WHERE Id = @myId", $conn) $cmd.Parameters.Add(new System.Data.CData.Highrise.HighriseParameter("@myId","10456255-0015501366")) $cmd.ExecuteNonQuery()

Insert Highrise Data

PowerShell

Add-Highrise -Connection $Highrise -Table Deals -Columns @("Name", "Price") -Values @("MyName", "MyPrice")

ADO.NET

$cmd = New-Object System.Data.CData.Highrise.HighriseCommand("INSERT INTO Deals (GroupId) VALUES (@myGroupId)", $conn) $cmd.Parameters.Add(new System.Data.CData.Highrise.HighriseParameter("@myGroupId","MyGroupId")) $cmd.ExecuteNonQuery()

Delete Highrise Data

PowerShell

Remove-Highrise -Connection $Highrise -Table "Deals" -Id "MyId"

ADO.NET

$cmd = New-Object System.Data.CData.Highrise.HighriseCommand("DELETE FROM Deals WHERE Id=@myId", $conn) $cmd.Parameters.Add(new System.Data.CData.Highrise.HighriseParameter("@myId","001d000000YBRseAAH")) $cmd.ExecuteNonQuery()