Automate SAP SuccessFactors LMS Integration Tasks from PowerShell
The CData ADO.NET Provider for SAP SuccessFactors LMS is a standard ADO.NET Provider that make it easy to accomplish data cleansing, normalization, backup, and other integration tasks by enabling real-time access to SAP SuccessFactors LMS.
ADO.NET Provider
The ADO.NET Provider provides a SQL interface for SAP SuccessFactors LMS; this tutorial shows how to use the Provider to retrieve SAP SuccessFactors LMS data.
Once you have acquired the necessary connection properties, accessing SAP SuccessFactors LMS data in PowerShell can be enabled in three steps.
SAP SuccessFactors LMS uses OAuth authentication. Before connecting, you must configure an OAuth application tied to your SAP SuccessFactors LMS account.
To establish a connection, set the following properties:
- User: Your SAP SuccessFactors LMS username.
- CompanyId: Your SAP SuccessFactors company identifier.
- Url: The SAP SuccessFactors API URL (e.g., https://api4.successfactors.com).
- OAuthClientId: The client Id assigned when you registered your custom OAuth application.
- OAuthClientSecret: The client secret assigned when you registered your custom OAuth application.
See the Getting Started chapter of the help documentation for a guide to creating a custom OAuth app and using OAuth.
-
Load the provider's assembly:
[Reflection.Assembly]::LoadFile("C:\Program Files\CData\CData ADO.NET Provider for SAP SuccessFactors LMS\lib\System.Data.CData.SAPSuccessFactorsLMS.dll") -
Connect to SAP SuccessFactors LMS:
$conn= New-Object System.Data.CData.SAPSuccessFactorsLMS.SAPSuccessFactorsLMSConnection("User=username;CompanyId=CompanyId;Url=https://api4.successfactors.com;InitiateOAuth=GETANDREFRESH;") $conn.Open() -
Instantiate the SAPSuccessFactorsLMSDataAdapter, execute an SQL query, and output the results:
$sql="SELECT ItemID, ItemTitle from Items" $da= New-Object System.Data.CData.SAPSuccessFactorsLMS.SAPSuccessFactorsLMSDataAdapter($sql, $conn) $dt= New-Object System.Data.DataTable $da.Fill($dt) $dt.Rows | foreach { Write-Host $_.itemid $_.itemtitle }