Skip to content

Dev-Mom/CreatePowerAutomateFlow

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Create Power Automate Flows Programmatically

A C# console application sample using the Power Automate Web API to programmatically read/write Power Automate flows.

Quick How-To

  1. Download or clone the repo so that you have a local copy.
  2. Open the sample solution in Visual Studio
  3. Review this article for guidance on interacting with API flows
  4. Replace the variable on line #17 with your Dataverse environment URL

    Retrieve a Flow

    1. Uncomment the RetrieveFlow method call on line #40
    2. Update the variable on line #113 with flow ID (GUID)
    3. Run the project!

    Create a Flow

    1. Uncomment the CreateFlow method call on line #41
    2. Update the variable on line #61 with relevant clientData content
    3. Run the project!

Tips & Tricks

  1. You will be prompted to enter a valid username and password.
  2. The account you provide must have access to the Dynamics CRM API's. (I have only tested this solution using a tenant global admin account.)
  3. If you have not run any CDS for Apps samples before, you will be asked to give consent.
  4. The auth functionality is borrowed from Jim Daly's sample. It's a great way to get started quickly, but should not be used to access sensitive/production data.
  5. The GET request for a single flow seems to fail intermittently. I have reported the behavior here.
  6. The CreateFlow method makes two different API calls. The first (POST) actually creates the flow and the second (PATCH) updates the statecode property to 1. This seems to be necessary and the flow will not function in the UI without such an update.
  7. I have only been able to programmatically create/access flows within the Default Solution for a relevant Dataverse environment. Microsoft does not mention this limitation in the web API documentation and I am uncertain of the scalability/performance implications.
  8. When the sample is finished, press any key to exit.

What this sample does

  • The CreateFlow method creates a Power Automate flow in the Solutions tab and then updates its statecode property to 1.
  • The RetrieveFlow method retrieves the flow object matching the ID/GUID provided.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages