Powershell からの Bullhorn CRM データ連携タスクを自動化

PowerShell から Bullhorn CRM に簡単に接続する方法をお探しですか? CData ADO.NET Provider for BullhornCRM は、PowerShell スクリプトの優位性を使い、シンプルで簡単に使えるADO.NET インターフェース を提供します。PowerShell スクリプトで、ADO.NET オブジェクトを使って簡単にBullhorn CRM に接続して、同期、自動化、ダウンロードなどが可能!

加藤龍彦
ウェブデベロッパー


こんにちは!ウェブ担当の加藤です。マーケ関連のデータ分析や整備もやっています。



CData ADO.NET Provider for BullhornCRM は、ADO.NET 標準インターフェースへ統合し、PowerShell のような. NET アプリケーションからBullhorn CRM API へのデータ連携を可能にします。このプロバイダーは、Bullhorn CRM の認証および相互作用を簡単にします。このチュートリアルでは、PowerShell から直接SQL クエリを実行するための、いくつかの一般的なADO.NET オブジェクトの使い方を説明します。

クエリの実行

次の3つのステップに従って create、read、update、およびdelete (CRUD) のデータ連携コマンドを PowerShell からリアルタイムBullhorn CRM に実行:

  1. プロバイダーのアセンブリをロード:

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

    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.

    $constr = "DataCenterCode=CLS33;OAuthClientId=myoauthclientid;OAuthClientSecret=myoauthclientsecret;" $conn= New-Object System.Data.CData.BullhornCRM.BullhornCRMConnection($constr) $conn.Open()
  3. BullhornCRMDataAdapter のインスタンスを生成してSQL クエリを実行し、結果を出力:

    $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 }

Bullhorn CRM データの更新

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

Bullhorn CRM へのデータの挿入

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

Bullhorn CRM データの削除

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

関連コンテンツ

トライアル・お問い合わせ

30日間無償トライアルで、CData のリアルタイムデータ連携をフルにお試しいただけます。記事や製品についてのご質問があればお気軽にお問い合わせください。