#Flow – Calling a Flow from a #CSharp ConsoleApp

Hello!

A couple of days ago I wrote a post where I shared how to use a Http Request as a trigger to be able to invoke a Flow definition from an external App (link). Today I´ll share an example with a bit of C# code to launch a Flow.

Let’s start with the definition of the Flow with 4 steps

  • Request
  • Create a file in OneDrive for Business with the contents of the Body that is received
  • Send a Push Notification
  • Return a code HTTP 200 in the Response

Clipboard06.jpg

Remember to copy the Url to invoke the flow. A sample C# source code may be similar the following image:

clipboard08

A couple of notes

  • Lines 10 to 15, create a JSON message from a C# class
  • With the body converted to JSON, I use JsonSchema.Net to create the Schema that I then add to the definition of the Flow
  • Lines 17 to 22, made the call to the Flow using RestSharp (link)

Ready! Our Flow Console App is complete and now we can run the app to call the Flow. Once the Flow is invoked we can see how the process triggers a notification to our device, with the link for access to the Url of the message!

clipboard01clipboard02

The sample code can be downloaded from here (link)

Greetings @ Toronto

El Bruno

References

42 comments

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.