“I use Power Automate for creation of new SharePoint list(s), but they’re not added to the navigation automatically. How can I add them in a flow?”
When you create new SharePoint lists using the SharePoint interface, you can add them also to the navigation. It’s just one checkbox to check during the list creation. But what if you’re creating lists automatically with a Power Automate flow? It doesn’t give you any checkbox, and it won’t automatically add the list to the navigation either. When using flow, you must implement the navigation adding functionality by yourself.
This post will show you two ways how to add SharePoint list to a navigation with Power Automate.
Send an HTTP request
The more universal solution is to use an HTTP request to SharePoint. With the HTTP request you can add any link to the navigation, you just define the link and the title. It’s not connected to the list creation, it’s a separate action which you can use whenever you need.
Method: POST
Uri:
_api/web/navigation/QuickLaunch
Headers:
Accept : application/json;odata=verbose
Content-Type : application/json;odata=verbose
Body:
{
"__metadata": {
"type": "SP.NavigationNode"
},
"Title": "<Name of the navigation link>",
"Url": "<Full link>"
}
Add link during the list creation
IMPORTANT Note: the addNavLink property is now by default in the list schema, use the request in the original article instead!
The second solution is an extension to the creation of new SharePoint list from an existing one. As already explained in that post, you can use your browser console to follow the communication during the list creation. And if you do that, you’ll notice ‘addNavLink’ property in the ExecuteTemplateScript() method input.
Since you won’t get this property from the GetSiteScriptFromList() (even though the documentation mentions it), you must add it by yourself. Power Automate has an expression addProperty(…) exactly for that.
addProperty(…) expression
AddProperty(…) expression allows you to add new property to an existing object. In this situation the object is everything between the [ and ] – the first object in the “actions” array. Unlike the original post, you can’t take the whole ‘actions’ value. The whole ‘actions’ value is an array, but you need only the first object from the array:
body('Parse_JSON')?['actions'][0]
To which you can then add the new property “addNavLink”: true.
addProperty(body('Parse_JSON')?['actions'][0],'addNavLink',true)
Use the whole expression inside the replace(…) from the original post to convert it into format required by the GetSiteScriptFromList() method.
replace(replace(string(addProperty(body('Parse_JSON')?['actions'][0],'addNavLink',true)),'\','\\'),'"','\"')
Enclose it back by the opening [ and closing ], which you removed to add the new property, and add the remaining elements to use it in the HTTP request.
{"script": "{\"actions\":[@{replace(replace(string(addProperty(body('Parse_JSON')?['actions'][0],'addNavLink',true)),'\','\\'),'"','\"')}]}"}
Such request will create a copy of an existing list and add it automatically to the site navigation.
Summary
This post explained two options how to add new SharePoint list into navigation with Power Automate. The first option with the separate HTTP request is more universal one. You can add any link, you can define it’s name, and you can add it anytime.
The second option is connected to the creation of SharePoint lists from existing ones and has a few limitations. You can use it only during the creation of a list, and the title of the link will be the title of the list.
Therefore, if the navigation title should be 1:1 to the list title, you can use both. If it should be different then you must use the separate HTTP request.
You are an absolute legend for putting this up, thank you for this guide!
I seriously thought I was doing something wrong and wasted a day debugging and working out if I did something wrong when the documentation example had shown it was part of the output.
Thanks again!
I’m getting a unique error when I try to add nav link during list creation:
Unable to process template language expressions in action ‘create_list’ inputs at line ‘1’ and column ‘22537’: ‘The template language expression ‘replace(replace(string(addProperty(body(‘get_list_contents’)?[‘actions’][0], ‘addNavLink’, true)),’\’,’\\’),'”‘,’\”‘)’ cannot be evaluated because property ‘0’ cannot be selected. Please see https://aka.ms/logicexpressions for usage details.’.
And the flow worked last week. Have I over looked something?
Hello Jessic,
I just tested the solution on my environment and didn’t encounter any issues. I’d check the ‘Parse JSON’ action (called probably ‘get_list_contents’ in your flow) in the run history if it contains the “actions” array. If it doesn’t there might be some problem with the previous http request (the one to get the list structure).
Thank you! Just added this to your “Create new SharePoint list from existing SP list with Power Automate” flow.
Another incredibly useful post.
Dear Tom,
Thanks a lot! Is it also possible to add the Link as a sublink of another one?
I am also trying to add a link as a sub link. But not having any luck. I tried to use this uri but the request just continues to run. It does not fail or complete successfully i just have to cancel the run. When i look at the Retry status, it says badgateway. So i am guessing this uri is no longer a valid one.
_api/Web/Navigation/GetNodeById(@{outputs(‘Home_Id’)})/Children
Hello Stella,
it’s possible like this: https://tomriha.com/add-sublink-to-sharepoint-navigation-with-power-automate/
How can you go about changing the index of a navigation link so it shows at the top of the list instead of the bottom? I’m adding a bunch of child links and that works fine doing it in order, but I want the parent link moved to the top and can’t find any index to modify.
Hi, if it’s possible to add a list VIEW to anvigation bar? thank you!