Azure Logic App: write to a dynamically specified SharePoint Online list

You might not be aware that using a Power Automate flow or using a Logic App it is possible to write to a dynamically specified SPO site and list. In the following example Azure Logic App, I'm passing both the URL to the SPO website and the list name using an HTTP POST call that triggers the logic app.

LogicApp2.png

Not being able to reference at design time a specific SPO list you won't get any support from the Azure App designer in terms of displaying on the "Create Item" action the exact set of columns that exist on the destination SPO list. For this reason, you will need to provide via the body property of the "Create Item" action a json object containing the set of list column names to be set and the corresponding values to be written. In my example, to keep things simple, columns and corresponding values to set on the new list item are hardcoded. As you may note, I've defined a few custom columns of different types on the list (a number column and a boolean column) to showcase writing different data types.

Although not particularly meaningful for what the example is meant to show, this is the full json schema specified for the request trigger:

JSON.png

Below, I show using a Google Chrome extension to call the Logic App's request trigger passing both the URL to my SPO site and the list name. Notice that the content type needs to be set to "application/json".

POST2.png

And finally, the following screenshot shows the freshly written list item in SPO.

SP2.png

Notice that the "Body" property on the "Create Item" action is displayed only when on the action the value for "Site Address" is not set statically but it is dynamic (for example provided via a previously defined variable).