SharePoint & Logic Apps - Get items by list title

Here's a short blog about a nifty trick a TREMENDOUSLY talented colleague of mine found.


Say you are developing a business application using Azure Logic Apps and SharePoint Online.
You'll want to deploy it to multiple SharePoint tenants or site collections within a tenant for system testing and user acceptance test purposes. And later easily go live on freshly installed site collection.

When you're using SharePoint actions like Get Items, Update item or similar, you'll have noticed that after filling in the list you want to use, Logic Apps will change the action to use the list GUID instead of the title behind the scenes. That's all fine and dandy until you move the logic app to a new site or tenant with a different list. Your Logic App will not work without manually changing the selected list in all the sharepoint actions. This is very cumbersome and error-prone work to do.

When you setup a release pipeline in Azure DevOps and deploy the Logic Apps through ARM Templates (extract them with this great tool by Jeff Hollan), you'll want to avoid such manual steps of course.


Here's a simple trick to do it. When you are developing the Logic App, simply define parameters for the List titles and also the site url. Basically anything that will be different for a different site collection or tenant. The nice thing is that in update or create item actions you'll still be able to easily fill in the field values even though the actions is not tied to the list by a unique id.

Logic App designer - parameters Define a parameter for a list tite

After you have then extracted the ARM template, your JSON definition of the Logic App will no longer contain GUIDs to lists. It will simply use the list titles.

ARM template parameters The parameters in the exported ARM template

Of course, you need to make sure you create a site with the same titles by using a PnP template for example. Also, no one can be changing the list titles, so make sure you lockdown those permissions well.

Hopfully this trick will save you some manual labor and prevent some mistakes!

Show Comments