I have a SharePoint list column which contains the data in xml form.
I need to parse it and e-mail the data in tabular form.
So, Any way to parse xml data using MS Flow ?
Solved! Go to Solution.
Hi @manjotsingh057,
Could you please share a bit more about your SharePoint list?
Could you please show a screenshot of your flow's configuration?
Further, does the UserData column store the XML data in your SharePoint list?
I assume that the XML data within the UserData column of your SharePoint list as below:
<?xml version="1.0"?> <Users> <User1 type="System.String">Manjot Singh</User1> </Users>
If you want to get the "Manjot Singh" from above XML data, please take a try with the following workaround:
<?xml version="1.0"?> <Users> <User1 type="System.String">Manjot Singh</User1> </Users>
xpath(xml(outputs('Compose')),'string(/Users/User1)')
Image reference:
The flow works successfully as below:
On your side, please take a try with the following formula:
xpath(xml(triggerBody()?['UsersData']),'string(//User1)')
Please take a try with above solution I provided and let me know if your issue is solved.
More details about Xpath function, please check the following article:
More details about Xpath examples, please check the following article:
https://msdn.microsoft.com/en-us/library/ms256086(v=vs.110).aspx
Best regards,
Kris
Here is a link to a post that explains how to parse XML using Flow
See the comments section
Hi Scott,
I tried below this expression -- xpath(xml(triggerBody()?['UsersData']),'//User1') to get the user1 node from my xml.
but i am getting output as xml "<User1 type="System.String">Manjot Singh</User1>"
Is there any way i can get only "Manjot Singh" as output from above xml ?
Hi @manjotsingh057,
Could you please share a bit more about your SharePoint list?
Could you please show a screenshot of your flow's configuration?
Further, does the UserData column store the XML data in your SharePoint list?
I assume that the XML data within the UserData column of your SharePoint list as below:
<?xml version="1.0"?> <Users> <User1 type="System.String">Manjot Singh</User1> </Users>
If you want to get the "Manjot Singh" from above XML data, please take a try with the following workaround:
<?xml version="1.0"?> <Users> <User1 type="System.String">Manjot Singh</User1> </Users>
xpath(xml(outputs('Compose')),'string(/Users/User1)')
Image reference:
The flow works successfully as below:
On your side, please take a try with the following formula:
xpath(xml(triggerBody()?['UsersData']),'string(//User1)')
Please take a try with above solution I provided and let me know if your issue is solved.
More details about Xpath function, please check the following article:
More details about Xpath examples, please check the following article:
https://msdn.microsoft.com/en-us/library/ms256086(v=vs.110).aspx
Best regards,
Kris
Kris,
Thanks for this. I already implemented same way. Just 1 minor change.
Since i have multiple <User1> nodes. using 'string(//User1)' does not work for me.It gives array since output would be of array type
I just used '//User1' which gives me the array of <User1> nodes and then using
"string(.)' in next action to get current node data as text.
Please try this. I require to parse a bunch of metadata information from an XML file and populate it into a SharePoint list.
XML file
Parse xpath - xpath(xml(outputs('XML_File')), 'string(//RequestType)')
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
Learn to digitize and optimize business processes and connect all your applications to share data in real time.
User | Count |
---|---|
13 | |
10 | |
9 | |
6 | |
6 |
User | Count |
---|---|
21 | |
20 | |
17 | |
8 | |
8 |