### Install and Run Sample App
Source: https://github.com/microsoftdocs/power-automate-docs/blob/main/articles/developer/embed-flow-dev.md
Use these npm commands to install dependencies and run the sample application for embedding Power Automate widgets. Ensure you have Node.js and npm installed.
```bash
> npm install
> node server.js
```
--------------------------------
### Install with Custom Installation Path
Source: https://github.com/microsoftdocs/power-automate-docs/blob/main/articles/desktop-flows/install-silently.md
This command installs Power Automate silently to a specified directory, D:\My Programs\foo, while accepting the EULA.
```CMD
Setup.Microsoft.PowerAutomate.exe -Silent -Install -ACCEPTEULA -INSTALLPATH: D:\My Programs\foo
```
--------------------------------
### START()
Source: https://github.com/microsoftdocs/power-automate-docs/blob/main/articles/minit/statistical-operations.md
Returns the start timestamp of a process, event, case, or edge.
```APIDOC
## START()
### Description
Returns the start of a process/event/case/path.
### Method
N/A (Function)
### Endpoint
N/A (Function)
### Parameters
None
### Request Example
None
### Response
#### Success Response (200)
- **Output Data Type**: DATE - The start timestamp.
#### Response Example
None
```
--------------------------------
### Connection String Examples
Source: https://github.com/microsoftdocs/power-automate-docs/blob/main/articles/desktop-flows/actions-reference/database.md
Examples of connection strings for different database types.
```APIDOC
## Connection String Examples
### Excel Database
```Connection string
Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\myFolder\myExcelFile.xlsx;Extended Properties="Excel 12.0 Xml;HDR=YES";
```
### Access Database
```Connection string
Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\myFolder\myAccessFile.accdb; Persist Security Info=False;
```
```
--------------------------------
### Install Power Automate Desktop Actions SDK
Source: https://github.com/microsoftdocs/power-automate-docs/blob/main/articles/guidance/how-to/build-custom-action/buildcustomaction.md
Use this PowerShell command to install the necessary SDK package for developing custom actions.
```powershell
Find-Package Microsoft.PowerPlatform.PowerAutomate.Desktop.Actions.SDK
NuGet\Install-Package Microsoft.PowerPlatform.PowerAutomate.Desktop.Actions.SDK
```
--------------------------------
### Example of Invoking Cabinet File Creation Script
Source: https://github.com/microsoftdocs/power-automate-docs/blob/main/articles/desktop-flows/create-custom-actions.md
A concrete example demonstrating how to run the cabinet creation script with specific paths and a filename for the custom module.
```powershell
.\makeCabFile.ps1 "C:\Users\Username\source\repos\MyCustomModule\bin\Release\net472" "C:\Users\Username\MyCustomActions" MyCustomActions.cab
```
--------------------------------
### Start EC2 Instance
Source: https://github.com/microsoftdocs/power-automate-docs/blob/main/articles/desktop-flows/actions-reference/aws.md
This action starts one or more EC2 instances. It requires an active EC2 client and a list of instance IDs.
```APIDOC
## Start EC2 Instance
### Description
Starts EC2 instance(s).
### Method
Not specified (assumed to be part of a larger flow execution)
### Endpoint
Not specified
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
None
### Request Example
None
### Response
#### Success Response (200)
- **StartingEc2Instances** ([List](../variable-data-types.md#list) of [Instance state changes](../variable-data-types.md#amazon-web-services-aws)) - The returned information for the started instances
#### Response Example
None
### Exceptions
- **Authentication failed**: Indicates that the provided credentials couldn't be validated
- **Unauthorized operation**: Indicates that an unauthorized operation was requested
- **Invalid instance ID**: Indicates that either the specified instance ID is malformed, or that the specified instance doesn't exist
- **Insufficient capacity**: Indicates that there isn't enough capacity to fulfill the request
- **Amazon service request failed**: Indicates that the request to AWS failed
```
--------------------------------
### Install Flow Approvals via PowerShell
Source: https://github.com/microsoftdocs/power-automate-docs/blob/main/articles/guidance/business-approvals-templates/setup.md
Use the Power Platform CLI to identify the target environment and install the Flow Approvals application.
```pwsh
$envs = (pac admin list --json | ConvertFrom-Json) | Where-Object { $_.DisplayName -eq "Your Environment Name" }
pac application install --environment $envs[0].EnvironmentId --application-name "msdyn_FlowApprovals"
```
--------------------------------
### FetchXML Query Example
Source: https://github.com/microsoftdocs/power-automate-docs/blob/main/articles/desktop-flows/actions-reference/workqueues.md
An example of a FetchXML query to filter and order work queue items.
```APIDOC
## FetchXML Query Example
### Description
An example FetchXML query to filter work queue items by name and order them by expiration date.
### Query
```xml
```
```
--------------------------------
### Perform Silent Installation
Source: https://github.com/microsoftdocs/power-automate-docs/blob/main/articles/desktop-flows/install-silently.md
Execute this command to install Power Automate for desktop silently. The -ACCEPTEULA argument is mandatory to accept the license terms.
```CMD
Setup.Microsoft.PowerAutomate.exe -Silent -Install -ACCEPTEULA
```
--------------------------------
### Execute Automation Kit Installation Script
Source: https://github.com/microsoftdocs/power-automate-docs/blob/main/articles/guidance/automation-kit/setup/command-line-install.md
Navigate to the extracted AutomationKitInstall directory and execute the main PowerShell installation script. Ensure your PowerShell execution policy allows script execution.
```cmd
cd AutomationKitInstall
powershell Install_AutomationKit.ps1
```
--------------------------------
### POST /start-virtual-machine
Source: https://github.com/microsoftdocs/power-automate-docs/blob/main/articles/desktop-flows/actions-reference/azure.md
Starts a specified virtual machine.
```APIDOC
## POST /start-virtual-machine
### Description
Starts the virtual machine.
### Parameters
#### Request Body
- **Azure client** (Azure client) - Required - The client used to connect to Azure.
- **Virtual machine name** (Text) - Required - The name of the virtual machine.
- **Resource group** (Text) - Required - The resource group of the virtual machine.
### Exceptions
- **VM wasn't found** - The specified VM wasn't found.
- **Failed to start the VM** - An error occurred while trying to start the VM.
```
--------------------------------
### Calculate Average Start Date for an Edge
Source: https://github.com/microsoftdocs/power-automate-docs/blob/main/articles/minit/requirements-for-application.md
Requires aggregation and functions valid for edges. This example returns the average start date for a given edge. Event-level attributes cannot be accessed.
```expression
AVG(AllInView,START())
```
--------------------------------
### Get subtext
Source: https://github.com/microsoftdocs/power-automate-docs/blob/main/articles/desktop-flows/actions-reference/text.md
Retrieves a subtext from a text value based on start index and length.
```APIDOC
## Get subtext
### Description
Retrieve a subtext from a text value.
### Method
N/A (This is an action, not an API endpoint)
### Parameters
#### Input Parameters
- **Original text** (Text value) - Required - The text to retrieve a section of text from
- **Start index** (N/A) - N/A - Specify how to find the starting point for text retrieval
- **Character position** (Numeric value) - Required - The position of the first character to retrieve. This value is a zero-based index, counting from zero for the first character
- **Length** (N/A) - N/A - Specify whether the subtext continues to the end of the text, or includes only a certain number of characters
- **Number of chars** (Numeric value) - Required - The number of characters to retrieve
### Variables produced
#### Subtext
- **Subtext** (Text value) - The retrieved subtext
### Exceptions
- **Start index or length are out of range** - Indicates that the start index or length are out of range
```
--------------------------------
### Reference parent record in Dataverse connector
Source: https://github.com/microsoftdocs/power-automate-docs/blob/main/articles/desktop-flows/work-queues-bulk-import.md
When using the Dataverse connector's 'Add a row' action, parent records are referenced using a specific pattern. This example shows how to reference a work queue using its GUID.
```text
/workqueues(44e44ea8-1af2-ed11-8848-000d3ae86f97)
```
--------------------------------
### Create Automated Cloud Flow - Manual Setup
Source: https://github.com/microsoftdocs/power-automate-docs/blob/main/articles/get-started-logic-flow.md
Manually create an automated cloud flow by selecting 'Automated cloud flow' and defining a trigger. This example uses the 'When a new tweet is posted' trigger from X.
```Power Automate
When a new tweet is posted - X
```
--------------------------------
### Initialize JS SDK Instance
Source: https://github.com/microsoftdocs/power-automate-docs/blob/main/articles/developer/embed-flow-dev.md
Create an instance of the SDK by providing optional hostName and locale configuration.
```javascript
var sdk = new MsFlowSdk({
hostName:'https://make.powerautomate.com',
locale:'en-US'
});
```
--------------------------------
### Display Help for Command Line Arguments
Source: https://github.com/microsoftdocs/power-automate-docs/blob/main/articles/desktop-flows/install-silently.md
Run this command to view all available command-line arguments for the Power Automate installer.
```CMD
Setup.Microsoft.PowerAutomate.exe -HELP
```
--------------------------------
### Start service
Source: https://github.com/microsoftdocs/power-automate-docs/blob/main/articles/desktop-flows/actions-reference/services.md
Starts a stopped Windows service.
```APIDOC
## Start service
### Description
Start a stopped Windows service.
### Parameters
#### Request Body
- **Service to start** (string) - Required - The name of the service to start.
### Exceptions
- **Service not found**: Indicates that the service can't be found.
- **Service is already running**: Indicates that the service is already running.
- **Can't start service**: Indicates that there's a problem starting the service.
```
--------------------------------
### GET /getsnapshotsaction
Source: https://github.com/microsoftdocs/power-automate-docs/blob/main/articles/desktop-flows/actions-reference/azure.md
Gets the snapshots based on the specified criteria.
```APIDOC
## GET /getsnapshotsaction
### Description
Gets the snapshots based on the specified criteria.
### Method
GET
### Parameters
#### Query Parameters
- **Azure client** (Azure client) - Required - The client used to connect to Azure
- **Retrieve snapshots** (Enum) - Optional - Specify which snapshots to retrieve (All, With the specified resource group, With the specified name in all resource groups, With specific name in the specified resource group)
- **Resource group** (Text value) - Required - The resource group where the snapshots reside
- **Snapshot name** (Text value) - Required - The name of the snapshot
### Response
#### Success Response (200)
- **Snapshots** (List of Azure snapshots) - The retrieved snapshots with all the related information
### Exceptions
- **Snapshot wasn't found** - Indicates that the specified snapshot wasn't found
- **Resource group wasn't found** - Indicates that the specified resource group wasn't found
- **Failed to get the snapshots with the specified criteria** - Indicates that getting the snapshots with the specified criteria failed
```
--------------------------------
### GET /api/windows/details
Source: https://github.com/microsoftdocs/power-automate-docs/blob/main/articles/desktop-flows/actions-reference/uiautomation.md
Gets a property of a window such as its title or its source text.
```APIDOC
## GET Get details of window
### Description
Gets a property of a window such as its title or its source text.
### Method
GET
### Endpoint
/api/windows/details
### Parameters
#### Query Parameters
- **Window** (UI element) - Required - The window to get details from
- **Window property** (string) - Optional - Get window title, Get window text, Get window location and size, Get process name - Choose which property of the window to extract. Default: Get window title
- **Bring to front** (boolean) - Optional - Specify whether the window containing the UI element will be brought to the front during execution. If this option is disabled, the action is executed in the background. Note that not all UI elements are compatible with having the option disabled. Additionally, if execution of the action requires scrolling, disabling this option might not extract all elements. Default: True
### Response
#### Success Response (200)
- **WindowProperty** (General value) - The retrieved information of the window
#### Error Response
- **Exception** (string) - Failed to retrieve property of window - Indicates a problem retrieving the window property
```
--------------------------------
### GET /api/ui-elements/details
Source: https://github.com/microsoftdocs/power-automate-docs/blob/main/articles/desktop-flows/actions-reference/uiautomation.md
Gets the value of a UI element's attribute in a window.
```APIDOC
## GET Get details of a UI element in window
### Description
Gets the value of a UI element's attribute in a window.
### Method
GET
### Endpoint
/api/ui-elements/details
### Parameters
#### Query Parameters
- **UI element** (UI element) - Required - The UI element to get details from
- **Attribute name** (string) - Optional - The attribute whose value will be retrieved. Default: Own Text
- **Bring to front** (boolean) - Optional - Specify whether the window containing the UI element will be brought to the front during execution. If this option is disabled, the action is executed in the background. Note that not all UI elements are compatible with having the option disabled. Additionally, if execution of the action requires scrolling, disabling this option might not extract all elements. Default: True
### Response
#### Success Response (200)
- **AttributeValue** (Text value) - The value of the UI element's text
#### Error Response
- **Exception** (string) - Failed to retrieve attribute of UI element - Indicates a problem retrieving the UI element's attribute
```
--------------------------------
### POST /show-desktop
Source: https://github.com/microsoftdocs/power-automate-docs/blob/main/articles/desktop-flows/actions-reference/workstation.md
Minimizes or restores all windows to reveal or hide the desktop.
```APIDOC
## POST /show-desktop
### Description
Shows the desktop.
### Parameters
#### Request Body
- **Operation** (Enum) - Optional - Minimize all windows (show desktop) or Restore all windows (undo show desktop)
```
--------------------------------
### Example calculation for custom metrics
Source: https://github.com/microsoftdocs/power-automate-docs/blob/main/articles/minit/custom-metrics-how-to.md
A practical implementation of the generic formula to calculate a ratio based on invoice amounts and case duration.
```text
Avg(ViewCases, 1.0 * InvoiceTotalAmountWithoutVAT / TOTALHOURS(Duration()))
```
--------------------------------
### Get column name on Excel worksheet
Source: https://github.com/microsoftdocs/power-automate-docs/blob/main/articles/desktop-flows/actions-reference/excel.md
Gets the name of the column based on its number.
```APIDOC
## Get column name on Excel worksheet
### Description
Gets the name of the column.
### Method
GET
### Endpoint
/excel/get-column-name
### Parameters
#### Path Parameters
N/A
#### Query Parameters
- **columnNumber** (number) - Required - The column number.
### Request Example
```
GET /excel/get-column-name?columnNumber=3
```
### Response
#### Success Response (200)
- **ColumnName** (string) - The name of the column.
#### Response Example
```json
{
"ColumnName": "C"
}
```
```
--------------------------------
### Configure Static Proxy via Registry
Source: https://github.com/microsoftdocs/power-automate-docs/blob/main/articles/desktop-flows/how-to/proxy-settings.md
Set machine-wide proxy settings using the command line. These commands affect all Power Automate for desktop components simultaneously.
```cmd
reg add "HKLM\SOFTWARE\Microsoft\Power Automate Desktop" /v ProxyServer /t REG_SZ /d "http://proxy.corp.com:8080" /f
```
```cmd
reg add "HKLM\SOFTWARE\Microsoft\Power Automate Desktop" /v ProxyServer /t REG_SZ /d "http://proxy.corp.com:8080" /f
reg add "HKLM\SOFTWARE\Microsoft\Power Automate Desktop" /v BypassProxyOnLocal /t REG_DWORD /d 1 /f
```
--------------------------------
### Install Azure AD module
Source: https://github.com/microsoftdocs/power-automate-docs/blob/main/articles/process-mining-pbi-workspace.md
Installs the Azure Active Directory module for PowerShell to manage service principals.
```powershell
Install-Module AzureAD
```
--------------------------------
### Listen for Widget Ready Event
Source: https://github.com/microsoftdocs/power-automate-docs/blob/main/articles/developer/embed-flow-dev.md
Listen for the WIDGET_READY event to execute host code after the widget has successfully initialized.
```javascript
widget.listen("WIDGET_READY", function() {
console.log("The flow widget is now ready.");
// other host code on widget ready
});
```
--------------------------------
### Get Special Folder Action
Source: https://github.com/microsoftdocs/power-automate-docs/blob/main/articles/desktop-flows/actions-reference/folder.md
Details regarding the output variables produced by the Get Special Folder action.
```APIDOC
## Get Special Folder
### Description
Retrieves a special folder object that provides access to the folder and its associated information.
### Variables Produced
- **SpecialFolderPath** (Folder) - The special folder object representing the requested system folder.
```
--------------------------------
### Import Solution using SDK for .NET
Source: https://github.com/microsoftdocs/power-automate-docs/blob/main/articles/manage-flows-with-code.md
Import a solution file using the ImportSolutionRequest. Set OverwriteUnmanagedCustomizations to true if existing flow instances need to be overwritten. Requires an authenticated IOrganizationService interface.
```csharp
///
/// Imports a solution.
///
/// Authenticated client implementing the IOrganizationService interface
/// The byte[] data representing a solution file.
public static void ImportSolution(
IOrganizationService service,
byte[] solutionFile) {
ImportSolutionRequest request = new() {
OverwriteUnmanagedCustomizations = true,
CustomizationFile = solutionFile
};
service.Execute(request);
}
```
--------------------------------
### Get details of SAP UI element
Source: https://github.com/microsoftdocs/power-automate-docs/blob/main/articles/desktop-flows/actions-reference/sap.md
Gets the value of an SAP UI element's attribute in an SAP window.
```APIDOC
## Get details of SAP UI element
### Description
Gets the value of an SAP UI element's attribute in an SAP window.
### Parameters
#### Request Body
- **SAPInstance** (SAP instance) - Required - Select the variable that holds the SAP instance you want to work with.
- **SAP element ID** (Numeric) - Required - The SAP element’s ID.
- **Attribute name** (Text value) - Required - The attribute whose value is retrieved.
### Response
#### Success Response (200)
- **AttributeValue** (Text value) - The value of the SAP UI element's attribute.
```
--------------------------------
### Run Application Action
Source: https://github.com/microsoftdocs/power-automate-docs/blob/main/articles/desktop-flows/actions-reference/system.md
This action allows you to run an application with specified command-line arguments, working directory, and window style. It also provides options for handling the application's lifecycle and timeouts.
```APIDOC
## RUN APPLICATION
### Description
Launches an application and optionally runs it with command-line arguments.
### Method
Not Applicable (Action)
### Endpoint
Not Applicable (Action)
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
- **Application path** (File) - Required - The executable file as a complete file path
- **Command line arguments** (Text value) - Optional - Add extra arguments that would go after the executable file name. For example, enter notepad.exe in the application path and a specific text file in the command line arguments
- **Working folder** (Folder) - Optional - The full path of the folder to work out of, if applicable.
- **Window style** (Normal, Hidden, Minimized, Maximized) - Default: Normal - Choose the appearance and size of the application window when it opens
- **After application launch** (Continue immediately, Wait for application to load, Wait for application to complete) - Default: Continue immediately - Whether the next action executes immediately, or waits until the program loads or completes
- **Timeout** (Numeric value) - Optional - The maximum wait time, and how long before forcing a continue
### Request Example
```json
{
"Application path": "C:\\Windows\\System32\\notepad.exe",
"Command line arguments": "C:\\Users\\Public\\Documents\\MyFile.txt",
"Working folder": "C:\\Users\\Public\\Documents",
"Window style": "Normal",
"After application launch": "Wait for application to complete",
"Timeout": 60
}
```
### Response
#### Success Response (200)
- **AppProcessId** (Numeric value) - The process ID output
- **AppExitCode** (Numeric value) - The application exit code
- **WindowHandle** (Numeric value) - The window handle. When opening a new window, this variable will catch the value of the window handle, and store it in this variable. A window handle is useful to specifically identify a window in a later action
#### Response Example
```json
{
"AppProcessId": 1234,
"AppExitCode": 0,
"WindowHandle": 5678
}
```
### Exceptions
- **File or application not found**: Indicates that the specified file or application wasn't found
- **Access denied for application or File**: Indicates that access was denied for the specified application or file
- **Can't retrieve application's main window handle**: Indicates a problem retrieving the application's main window handle
- **Can't execute application or open file**: Indicates a problem executing the specified application or opening the specified file
```