web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Unable to run the C# c...
Power Automate
Unanswered

Unable to run the C# code in Power automate desktop

(0) ShareShare
ReportReport
Posted on by 7

PraveenReddy_0-1699513708270.png

Hi Team,

Can anyone help on this issue? I have just tried to create a DataTable using the C# code and I'm getting the error below.

Correlation Id: e81b62cf-148f-41ef-a211-106aa58d412b

Exception of type 'Microsoft.Flow.RPA.Desktop.Robin.DotNetEngine.Errors.DynamicOperationCompilationException' was thrown.: Microsoft.PowerPlatform.PowerAutomate.Desktop.Actions.SDK.ActionException: The type name 'DataTable' could not be found in the namespace 'System.Data'. This type has been forwarded to assembly 'System.Data.Common, Version=0.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' Consider adding a reference to that assembly., The type name 'DataTable' could not be found in the namespace 'System.Data'. This type has been forwarded to assembly 'System.Data.Common, Version=0.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' Consider adding a reference to that assembly. ---> Microsoft.Flow.RPA.Desktop.Robin.DotNetEngine.Errors.DynamicOperationCompilationException: Exception of type 'Microsoft.Flow.RPA.Desktop.Robin.DotNetEngine.Errors.DynamicOperationCompilationException' was thrown.
at Microsoft.Flow.RPA.Desktop.Robin.DotNetEngine.Core.DynamicOperationController.EnsureNoErrors(IEnumerable`1 diagnostics, String code)
at Microsoft.Flow.RPA.Desktop.Robin.DotNetEngine.Core.DynamicOperationController.Initialize(DynamicScriptOperationParams p)
at Microsoft.Flow.RPA.Desktop.Robin.DotNetEngine.Caching.OperationControllerCacheProxy.Initialize(DynamicScriptOperationParams p)
at Microsoft.Flow.RPA.Desktop.Modules.System.Actions.RunDotNetScript.Execute(ActionContext context)
--- End of inner exception stack trace ---
at Microsoft.Flow.RPA.Desktop.Modules.System.Actions.RunDotNetScript.Execute(ActionContext context)
at Microsoft.Flow.RPA.Desktop.Robin.Engine.Execution.ActionRunner.Run(IActionStatement statement, Dictionary`2 inputArguments, Dictionary`2 outputArguments)

I have the same question (0)
  • Agnius Bartninkas Profile Picture
    Most Valuable Professional on at

    Why exactly are you trying to do it like this? There is a native action for creating a data table in PAD called Create new data table.

    -------------------------------------------------------------------------
    If I have answered your question, please mark it as the preferred solution. If you like my response, please give it a Thumbs Up.

    I also provide paid consultancy and development services using Power Automate. If you're interested, DM me and we can discuss it.

  • PraveenReddy Profile Picture
    7 on at

    I would like to perform some DataTable operations so I just checked it whether it's working or not. my main motive is to filter the DataTable.

  • Agnius Bartninkas Profile Picture
    Most Valuable Professional on at

    I recommend reading this article for references on how to use the Run .NET script to work with data tables: https://www.linkedin.com/pulse/how-run-net-script-action-empowers-data-table-power-automate-bysani/

    -------------------------------------------------------------------------
    If I have answered your question, please mark it as the preferred solution. If you like my response, please give it a Thumbs Up.

    I also provide paid consultancy and development services using Power Automate. If you're interested, DM me and we can discuss it.

  • PraveenReddy Profile Picture
    7 on at

    However why it's not working in C#? I'm more comfortable in C#

  • kinuasa Profile Picture
    797 Most Valuable Professional on at
    However why it's not working in C#? I'm more comfortable in C#

    There is no problem with C#.

    CreateDatatableWithRunDotNetScriptAction.jpg

     

    custTable = new DataTable();
    custTable.Columns.Add("Customers", typeof(String));
    DataRow dr = custTable.NewRow();
    dr["Customers"] = "hoge";
    custTable.Rows.Add(dr);

     

    P.S.
    System.Data.dll may not have needed to be loaded.

     

  • PraveenReddy Profile Picture
    7 on at

    See i'm getting the below error

     

    PraveenReddy_0-1699599100936.pngPraveenReddy_1-1699599139409.png

     

  • kinuasa Profile Picture
    797 Most Valuable Professional on at

    1. Please set the Script parameters from [Edit].
    2. There is no need to declare "ordersTable" by 1.

     

    ordersTable = new DataTable("Orders");

    CreateDatatableWithRunDotNetScriptAction(2).jpg

     

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 630

#2
Valantis Profile Picture

Valantis 420

#3
11manish Profile Picture

11manish 350

Last 30 days Overall leaderboard