A Modern Autograph Book - Part 5 - Azure Function

Well here we are with the final part of creating our Modern Autograph Book. We have a PowerApp, Flow and some data within SharePoint, we just need our Azure Function now to combine the data into a Word document. The reason I am using an Azure Function is because I want to be able to leverage the OpenXML standard to modify the contents of a Word Document grammatically.

Effectively what I want my function to do is to receive some basic data from Flow, which will then reach into SharePoint to retrieve the images (Photograph and Autograph), create a new Word Document and then insert the pictures and the name.

Create an Azure Function

To create your Azure Function, there's a simple article provided by Microsoft which will guide you through the Azure Portal to create the Function App: Create your first function in the Azure portal.

Specifically what I'm doing for this demo, is to use Visual Studio to direct publish the code to the Azure Function. Again, depending on how you want to deploy, you could set up Continuous Deployment from your preferred code repository.

Create a new Function Project

There are a number of tools which you can use to create new Azure Functions. If I'm developing in C#, which I'm going to use for this example, then I like to use Visual Studio 2017 which has the built in Function template. Every developer is different, so don't feel like this is the only tool which you can use, use which ever method you feel most comfortable with.

Also, to keep things simple for this scenario, I'm going to use a Http Trigger, as that can be very easily called from our Flow, where we put the call HTTP Service action.

Once in there you can pull in the required packages from Nuget, which are:
From there I've added some code which will effectively create a copy of a template file, temporarily download the various assets, and then upload the compiled document back to SharePoint. A very very simple function, but it does the job for this demonstration.

You can find the complete code for this Azure Function in Azure DevOps

I chose to deploy straight from Visual Studio, in this instance. Visual Studio 2017 is extremely well integrated with Azure, so I can use my Cloud Explorer to determine where I want to deploy the solution too, as well as attach a remote debugger to ensure that my code is working as I expect it to.

Update Flow

Now that we have created our Azure Function, we just need to go back and update Flow with the trigger address. This address can be found in the Azure Portal, by navigating to your Function App and selecting the relevant Function.

You will then be able to copy the URL directly from the modal dialogue which pops up.

Let's switch back to Flow and locate the HTTP call which we're going to paste the function URL into.


I will expand out that HTTP action and start to provide the basic details that I want to include. The key things are that I select POST as the method, as that is what I want to do, post the data to my function. I also need to provide some detail in the call body, which is where I'm going to pass the tenancy, site and name. I've hard coded the tenancy and site in, but I've used the output from my Get Person Name action earlier in the Flow.

This will trigger my Azure Function and complete the solution.

Finally!

After all of this, we now have an end-to-end solution which will take a signature and a photograph from PowerApps, push them into SharePoint and combine them into a Word document. The whole solution is a complete gimmick, but hopefully it's given you some food for thought as to how you can combine these Microsoft technologies to provide a great end-to-end solution.

Comments

  1. Betway Casino Sports Betting Odds - Online Gaming
    Betway Mobile Casino - Online Gaming. Betway Mobile Casino. Betway Mobile Casino. Betway 파워볼 찍어먹기 벳무브 Mobile how to buy air jordan 18 retro toro mens sneakers Casino. betway Mobile Casino. jordan 18 white royal blue clearance Betway 포커 하는 법 Mobile air jordan 18 retro men red from me Casino. Betway Mobile

    ReplyDelete

Post a Comment