Showing results for 
Search instead for 
Did you mean: 
Frequent Visitor

SharePoint list items to xml file

Hi, I'm trying to create an xml file from SharePoint. I'm having trouble and pretty much the information I find is creating items from xml...What I've been trying so far is:

1. Get items from SharePoint list (custom columns)

2. Format item information into variable (loop)

3. Compose xml from variable information

4. Save xml document


It was successful until I tried setting my variables to get the custom information I need into the xml file. It Automatically creates an Apply To Each loop, and when I try referencing it I get an error.


Is there something I'm missing? Is there an easier way to go about it?


I appreciate any insight!

Power Participant
Power Participant

Could you give us an example of some of the data you're working with, and perhaps some screenshots of the flow, please @asmith2 ?


If you edit the initial question with them it'll maybe also help further.




Suffice to say, purely thinking about a field in a given JSON object, you can get the value of a field from another action using either outputs(), body(), variable(), or some others, with a query on the individual field using a question mark and then square brackets enclosing the field name in single quotes.


So if I had pushed a JSON object in to a variable called jsonVAR, and in a subsequent action I wanted only the 'date' field's value from that I would use:



This works differently with an array.


Perhaps I should start from the beginning, as it's completely possible that what I've done so far is wrong. 🙂


We are uploading documents into a federal site. This site requires an XML file, with certain formatting.


I have a SharePoint list connected to a form that the employees fill out. Then I am needing a flow that takes the items from the list, and makes them into XML files (or file, with each item as it's own page).


An example of the formatting necessary (taken from the federal guidelines):
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE CashServices SYSTEM "CashServices.dtd">


I've taken the items from the sharepoint list, so each item will fill in the 
-Branch ABA




-Order amounts

-Order totals


After looking around, I saw people take the information and do a couple things to do...create html information to convert to an xml...or...put the information into a variable and then use the compose->xml...


Creating a variable is what I tried to mimic. 

It works IF I do it this way:


But then you end up with a ton of different documents...from each item on the list...


Is there not a way to take the information from the list...and create ONE xml document where the items are on different pages? (to be done every day, at the end of the day)

Power Participant
Power Participant

OK, I'll see if I can work it out, but it might be out of my wheelhouse, as I'm new to XML.


You'll definitely want to look at using expressions with xpath() and xml() to create the XML, though.


I recently adapted @JohnLiu's excellent XML hack to basically write something that can parse any single JSON object into XML over here on Stack. Just remove the filter step that removes empty entries, and the conversion back to a JSON array, and you're looking good!


Additionally, it might be worth contacting the government agency, most websites that have a submission form that accepts the data will quite possibly accept other methods (like JSON).

Those look really useful. I'll test out that method. Thanks!

Helpful resources

UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (2,021)