Ready to get started?

Download a free trial of the Outreach.io Data Provider to get started:

 Download Now

Learn more:

Outreach.io Icon Outreach.io ADO.NET Provider

Rapidly create and deploy powerful .NET applications that integrate with Outreach.io.

Automate Outreach.io Integration Tasks from PowerShell



Are you in search of a quick and easy way to access Outreach.io data from PowerShell? This article demonstrates how to utilize the Outreach.io Cmdlets for tasks like connecting to Outreach.io data, automating operations, downloading data, and more.

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

PowerShell Cmdlets or ADO.NET Provider?

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

Once you have acquired the necessary connection properties, accessing Outreach.io data in PowerShell can be enabled in three steps.

You must use OAuth to authenticate with Outreach. Set the InitiateOAuth connection property to "GETANDREFRESH". For more information, refer to the OAuth section in the Help documentation.

PowerShell

  1. Install the module:

    Install-Module OutreachCmdlets
  2. Connect:

    $outreach = Connect-Outreach
  3. Search for and retrieve data:

    $industry = "Textiles" $accounts = Select-Outreach -Connection $outreach -Table "Accounts" -Where "Industry = `'$Industry`'" $accounts

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

    $accounts = Invoke-Outreach -Connection $outreach -Query 'SELECT * FROM Accounts WHERE Industry = @Industry' -Params @{'@Industry'='Textiles'}

ADO.NET

  1. Load the provider's assembly:

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

    $conn= New-Object System.Data.CData.Outreach.OutreachConnection("InitiateOAuth=GETANDREFRESH") $conn.Open()
  3. Instantiate the OutreachDataAdapter, execute an SQL query, and output the results:

    $sql="SELECT Name, NumberOfEmployees from Accounts" $da= New-Object System.Data.CData.Outreach.OutreachDataAdapter($sql, $conn) $dt= New-Object System.Data.DataTable $da.Fill($dt) $dt.Rows | foreach { Write-Host $_.name $_.numberofemployees }

Update Outreach.io Data

PowerShell

Update-Outreach -Connection $Outreach -Columns @('Name','NumberOfEmployees') -Values @('MyName', 'MyNumberOfEmployees') -Table Accounts -Id "MyId"

ADO.NET

$cmd = New-Object System.Data.CData.Outreach.OutreachCommand("UPDATE Accounts SET Industry='Textiles' WHERE Id = @myId", $conn) $cmd.Parameters.Add((New-Object System.Data.CData.Outreach.OutreachParameter("@myId","10456255-0015501366"))) $cmd.ExecuteNonQuery()

Insert Outreach.io Data

PowerShell

Add-Outreach -Connection $Outreach -Table Accounts -Columns @("Name", "NumberOfEmployees") -Values @("MyName", "MyNumberOfEmployees")

ADO.NET

$cmd = New-Object System.Data.CData.Outreach.OutreachCommand("INSERT INTO Accounts (Industry) VALUES (@myIndustry)", $conn) $cmd.Parameters.Add((New-Object System.Data.CData.Outreach.OutreachParameter("@myIndustry","Textiles"))) $cmd.ExecuteNonQuery()

Delete Outreach.io Data

PowerShell

Remove-Outreach -Connection $Outreach -Table "Accounts" -Id "MyId"

ADO.NET

$cmd = New-Object System.Data.CData.Outreach.OutreachCommand("DELETE FROM Accounts WHERE Id=@myId", $conn) $cmd.Parameters.Add((New-Object System.Data.CData.Outreach.OutreachParameter("@myId","001d000000YBRseAAH"))) $cmd.ExecuteNonQuery()