Run .NET script(Power Automate Desktop Action)

08/24/2023

Japanese version.

This action was added in the July 2023 update and run code in C# or VB.NET.

Both C# and VB.NET are programming languages for large-scale development and are relatively unsuitable for RPA applications.

Due to the high expertise hurdle, it is recommended that actions in other scripting languages be used.

This action is mainly useful in situations where you want to use the functionality of an already existing dll (Dynamic Link Library) with Power Automate Desktop.

In this case, knowledge of C# and VB.NET is still required.

How to use

Drag "Run .NET script" from "Scripting" under "Actions".

Set parameters.

Parameters

Language

Select the programming language to be executed in the action. At present, C# is the predominant development language, while VB.NET is probably mainly used to leverage past assets.

.NET script imports

This item is specified in "using" for C# and "Imports" for VB.

Specify the namespace. Separate the namespace with only a new line without ";", "using", "Imports", or ";".

References to be loaded

Set when using dll (Dynamic Link Library: DLL, dynamic link library).

Specify the folder where dll files are stored. When specifying multiple dlls, collect the dlls in one folder.

Script parameters

Configure settings for exchanging values between Power Automate Desktop and the code to be executed.

Click "Edit" to configure.

.NET parameter name

Set name of the variable in the code.

Type

Data types of variables in C# and VB.NET.

  • String
  • Boolean
  • Datatable
  • Datetime
  • Decimal
  • Double
  • Dynamic
  • Integer
  • List
  • Long

Direction

Select direction of the variable.

  • In (Giving a value to the code from Power Automate Desktop)
  • Out (Returns values from the code to Power Automate Desktop)
  • In-Out (both input and output)

Input value

Set if "Direction" is "In" or "In-Out".

Set the value given to the code from Power Automate Desktop. Can be a variable or a fixed value.

Output variable

Set if the direction is "outside" or "in/out".

Specifies the variable that will receive the value returned from the code to Power Automate Desktop.

The value of the variable in the code will be set to the variable in Power Automate Desktop at the end of code execution.

.NET code to run

Sets the code to be run. Variables can also be set, so it is possible to run code read in "Read text from file".

For those who want to learn Power Automate Desktop effectively


The information on this site is now available in an easy-to-read e-book format.

Or Kindle Unlimited (unlimited reading).

You willl discover how to about basic operations.

By the end of this book, you will be equipped with the knowledge you need to use Power Automate Desktop to streamline your workflow.

Links

Scripting Actions