Change the name of SharePoint list ‘from template’ with Power Automate

“You have everything, get list template, create new list but it is creating a new list with the same name, if it already exists Power Automate won’t create a new one.”


As pointed out in the comments, the solution to create a new SharePoint list from an existing one can be extended. As it is now, it’ll always create the list with the same name. But if you use it within the same site, you can’t create multiple lists with the same name. In these situations you might need to define a new name for the list. And this article will show you how.

Change the list name

As already shown in the original article, list name is one of the properties in the JSON. By default it’s the name of the source list, but it’s not fixed. If you change the value of that property, you can change the name of the new list.

Power Automate list template name

It’s a similar approach as when you add the list to the navigation. You must take the content of the ‘actions’ object, and change it. When adding the navigation, you’re adding a new property. This time the property already exists, it’s the ‘listName’. Therefore, you can just change it using the setProperty(…) expression.

The setProperty(…) will take an object, find a property, and set it to the desired value, e.g.

setProperty(<actions>, 'listName', 'New list name')

Note: the <actions> part is just a simplified string, it’s not the real input.

Add it to the expression used to create a list (without navigation):

replace(replace(string(setProperty(body('Parse_JSON')?['actions'][0],'listName', 'New list name')),'\','\\'),'"','\"')

Or to the expression used to create a list including the navigation:

replace(replace(string(setProperty(addProperty(body('Parse_JSON')?['actions'][0],'addNavLink',true),'listName','New list name')),'\','\\'),'"','\"')

Summary

When you create a new SharePoint list from a template, Power Automate allows you to make some changes, e.g. the name. You just need to find the right property, add it if it’s missing (navigation) or change the value if it already exists (list name).


Do you struggle with the various expressions, conditions, filters, or HTTP requests available in Power Automate?

I send one email per week with a summary of the new solutions, designed to help even non IT people to automate some of their repetitive tasks.

All subscribers have also access to resources like a SharePoint Filter Query cheat sheet or Date expressions cheat sheet.

Zero spam, unsubscribe anytime.

Add a Comment

Your email address will not be published. Required fields are marked *