![]() |
VOOZH | about |
The CData Cmdlets for Asana are standard PowerShell cmdlets that make it easy to accomplish data cleansing, normalization, backup, and other integration tasks by enabling real-time access to Asana.
The Cmdlets are not only a PowerShell interface to Asana, but also an SQL interface; this tutorial shows how to use both to retrieve Asana data. We also show examples of the ADO.NET equivalent, which is possible with the CData ADO.NET Provider for Asana. To access Asana data from other .NET applications, like LINQPad, use the CData ADO.NET Provider for Asana.
Once you have acquired the necessary connection properties, accessing Asana data in PowerShell can be enabled in three steps.
You can optionally set the following to refine the data returned from Asana.
You must use OAuth to authenticate with Asana. OAuth requires the authenticating user to interact with Asana using the browser. See the "Getting Started" chapter of the help documentation for a guide to using OAuth.
Install the module:
Install-Module AsanaCmdlets
Connect:
$asana = Connect-Asana -OAuthClientId "$OAuthClientId" -OAuthClientSecret "$OAuthClientSecret" -CallbackURL "$CallbackURL" -InitiateOAuth "$InitiateOAuth"
Search for and retrieve data:
$archived = "true" $projects = Select-Asana -Connection $asana -Table "projects" -Where "Archived = `'$Archived`'" $projects
You can also use the Invoke-Asana cmdlet to execute SQL commands:
$projects = Invoke-Asana -Connection $asana -Query 'SELECT * FROM projects WHERE Archived = @Archived' -Params @{'@Archived'='true'}
Load the provider's assembly:
[Reflection.Assembly]::LoadFile("C:\Program Files\CData\CData ADO.NET Provider for Asana\lib\System.Data.CData.Asana.dll")
Connect to Asana:
$conn= New-Object System.Data.CData.Asana.AsanaConnection("OAuthClientId=YourClientId;OAuthClientSecret=YourClientSecret;CallbackURL='http://localhost:33333';InitiateOAuth=GETANDREFRESH;")
$conn.Open()
Instantiate the AsanaDataAdapter, execute an SQL query, and output the results:
$sql="SELECT Id, WorkspaceId from projects"
$da= New-Object System.Data.CData.Asana.AsanaDataAdapter($sql, $conn)
$dt= New-Object System.Data.DataTable
$da.Fill($dt)
$dt.Rows | foreach {
Write-Host $_.id $_.workspaceid
}
Download a free trial of the Asana Data Provider to get started:
Download NowLearn more:
👁 Asana IconRapidly create and deploy powerful .NET applications that integrate with Asana.