Hi everyone,
TL;DR: How do I format SharePoint Lists created through HTTP Request during a flow?
My goal is to create a new SharePoint List with advanced view formatting with a Flow in Power Automate.
I might be over-complicating what I want to do, but here is the context:
This is a flow that triggers when an item is added to my SharePoint List and creates another List and links back to it.
I got that part done using HTTP requests.
Here is my current flow.
This is the body of the HTTP request:
The next part would be to format the new SharePoint List view to include a new button in the command bar that, when clicked triggers another Flow that will allow me to add multiple copies of the same record when specified. For example:
The new button would prompt to a formatted record entry form that would ask for the following fields:
Input
Number of vials: 3
Reagent: Cell Culture Media
Location: Lab1
Expiration: 04/20/2023
Output
Item Name, Location, Expiration
Cell Culture Media, Lab1, 04/20/2023
Cell Culture Media, Lab1, 04/20/2023
Cell Culture Media, Lab1, 04/20/2023
This entry will add 3 items (ie. 3 rows) to the new SharePoint List. All with the same data (different autogenerated IDs of course).
The main problem for me is that I want to do this by formatting the view and/or column at the moment of making the new SharePoint List, modifying this section:
Is this possible?
Some workarounds I've thought of are:
1. Create a base template myself for the new SharePoint List in the folder where they will be created, then make the first flow just copy that template list with a new name whenever a new item is added to the master List.
2. Make the 2nd Flow trigger automatically when a new item is added to any SharePoint List in the folder where the new Lists will be saved, forgetting about formatting and adding the new button to the new SharePoint List dynamically.
Thank you!
Hey @Expiscornovus ,
This is really helpful, I didn't know there was an endpoint method to update the XML files from power automate.
I tried what you suggested and the flow runs successfully, but I still can't see the alternating row formatting on this test list. See:
(I made sure to name my variables the exact same as yours).
Two follow up questions:
1. Where can I find more complete documentation about the API endpoint methods? For example, the SetViewXml method is not mentioned in the docs for SharePoint as far as I can see .
2. Is is possible to set the entire XML structure, including multiple fields, and view using only 1 post request? That way I wouldn't have to make multiple HTTP request in succession to add every field (I need to add 5) and then an extra one to edit the view.
Thanks!
PS: just subscribed to your channel
Hi @sergio_flows,
You can use a setviewxml method to update the customformatter property of your newly created view.
Below is an example
In this example I am setting the alternating row styles formatting.
Payload Body
{"viewXml":"<View Name=\"{@{variables('ViewId')}}\" Type=\"HTML\" DisplayName=\"Formatted View\" Url=\"/sites/PowerUsers/@{variables('ListName')}/Forms/Formatted View.aspx\" Level=\"1\" BaseViewID=\"1\" ContentTypeID=\"0x\" ImageUrl=\"/_layouts/15/images/dlicon.png?rev=47\"><Query/><ViewFields><FieldRef Name=\"DocIcon\"/><FieldRef Name=\"LinkFilename\"/><FieldRef Name=\"Modified\"/><FieldRef Name=\"Editor\"/><FieldRef Name=\"ID\"/></ViewFields><RowLimit Paged=\"TRUE\">30</RowLimit><JSLink>clienttemplates.js</JSLink><XslLink Default=\"TRUE\">main.xsl</XslLink><CalendarViewStyles><CalendarViewStyle Title=\"Day\" Type=\"day\" Template=\"CalendarViewdayChrome\" Sequence=\"1\" Default=\"FALSE\"/><CalendarViewStyle Title=\"Week\" Type=\"week\" Template=\"CalendarViewweekChrome\" Sequence=\"2\" Default=\"FALSE\"/><CalendarViewStyle Title=\"Month\" Type=\"month\" Template=\"CalendarViewmonthChrome\" Sequence=\"3\" Default=\"FALSE\"/></CalendarViewStyles><Toolbar Type=\"Standard\"/><CustomFormatter><![CDATA[{\"additionalRowClass\":{\"operator\":\":\",\"operands\":[{\"operator\":\"==\",\"operands\":[{\"operator\":\"%\",\"operands\":[\"@rowIndex\",2]},0]},\"sp-css-backgroundColor-BgLightGray30\",{\"operator\":\":\",\"operands\":[{\"operator\":\"==\",\"operands\":[{\"operator\":\"%\",\"operands\":[\"@rowIndex\",2]},1]},\"sp-css-backgroundColor-noFill\",\"\"]}]},\"rowClassTemplateId\":\"BgColorAlternateRows\"}]]></CustomFormatter></View>"}
Michael E. Gernaey
138
Super User 2025 Season 1
David_MA
135
Super User 2025 Season 1
stampcoin
125