Ready to get started?

Learn more about the CData ADO.NET Provider for Bullhorn CRM or download a free trial:

Download Now

Automate Bullhorn CRM Integration Tasks from PowerShell

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

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

Cmdlets or ADO.NET?

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

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

Begin by providing your Bullhorn CRM account credentials in the following:

If you are uncertain about your data center code, codes like CLS2, CLS21, etc. are cluster IDs that are contained in a user's browser URL (address bar) once they are logged in.

Example: https://cls21.bullhornstaffing.com/BullhornSTAFFING/MainFrame.jsp?#no-ba... indicates that the logged in user is on CLS21.

Authenticating with OAuth

Bullhorn CRM uses the OAuth 2.0 authentication standard. To authenticate using OAuth, create and configure a custom OAuth app. See the Help documentation for more information.

PowerShell

  1. Install the module:

    Install-Module BullhornCRMCmdlets
  2. Connect:

    $bullhorncrm = Connect-BullhornCRM -DataCenterCode "$DataCenterCode" -OAuthClientId "$OAuthClientId" -OAuthClientSecret "$OAuthClientSecret"
  3. Search for and retrieve data:

    $candidatename = "Jane Doe" $candidate = Select-BullhornCRM -Connection $bullhorncrm -Table "Candidate" -Where "CandidateName = `'$CandidateName`'" $candidate

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

    $candidate = Invoke-BullhornCRM -Connection $bullhorncrm -Query 'SELECT * FROM Candidate WHERE CandidateName = @CandidateName' -Params @{'@CandidateName'='Jane Doe'}

ADO.NET

  1. Load the provider's assembly:

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

    $conn= New-Object System.Data.CData.BullhornCRM.BullhornCRMConnection("DataCenterCode=CLS33;OAuthClientId=myoauthclientid;OAuthClientSecret=myoauthclientsecret;InitiateOAuth=GETANDREFRESH") $conn.Open()
  3. Instantiate the BullhornCRMDataAdapter, execute an SQL query, and output the results:

    $sql="SELECT Id, CandidateName from Candidate" $da= New-Object System.Data.CData.BullhornCRM.BullhornCRMDataAdapter($sql, $conn) $dt= New-Object System.Data.DataTable $da.Fill($dt) $dt.Rows | foreach { Write-Host $_.id $_.candidatename }

Update Bullhorn CRM Data

PowerShell

Update-BullhornCRM -Connection $BullhornCRM -Columns @('Id','CandidateName') -Values @('MyId', 'MyCandidateName') -Table Candidate -Id "MyId"

ADO.NET

$cmd = New-Object System.Data.CData.BullhornCRM.BullhornCRMCommand("UPDATE Candidate SET CandidateName='Jane Doe' WHERE Id = @myId", $conn) $cmd.Parameters.Add(new System.Data.CData.BullhornCRM.BullhornCRMParameter("@myId","10456255-0015501366")) $cmd.ExecuteNonQuery()

Insert Bullhorn CRM Data

PowerShell

Add-BullhornCRM -Connection $BullhornCRM -Table Candidate -Columns @("Id", "CandidateName") -Values @("MyId", "MyCandidateName")

ADO.NET

$cmd = New-Object System.Data.CData.BullhornCRM.BullhornCRMCommand("INSERT INTO Candidate (CandidateName) VALUES (@myCandidateName)", $conn) $cmd.Parameters.Add(new System.Data.CData.BullhornCRM.BullhornCRMParameter("@myCandidateName","Jane Doe")) $cmd.ExecuteNonQuery()

Delete Bullhorn CRM Data

PowerShell

Remove-BullhornCRM -Connection $BullhornCRM -Table "Candidate" -Id "MyId"

ADO.NET

$cmd = New-Object System.Data.CData.BullhornCRM.BullhornCRMCommand("DELETE FROM Candidate WHERE Id=@myId", $conn) $cmd.Parameters.Add(new System.Data.CData.BullhornCRM.BullhornCRMParameter("@myId","001d000000YBRseAAH")) $cmd.ExecuteNonQuery()