Solved

Error in getting xml of SharePoint item

  • 28 February 2022
  • 5 replies
  • 172 views

Hello everyone,

I am trying to get xml of SharePoint list item, using web request. The list item is getting created when we submit an InfoPath form. When I use web request it gives me xml but it just consist the columns that are in SharePoint list not the one which are in form.

Web request works fine when I use current item (the nodes comes are like my: name, etc.), but when I use URL, it shows unauthorised or give xml like d:name, and not contain the required xml.

My Scenario is : I am copying a list item in same list using copy to SharePoint action, then I need to update the xml of new item (copied). I want to do this in same workflow, as if new workflow will be used it will wait for 5 minutes to run, and I want to reduce this time. I try to use update xml directly, by providing URL to xml, as a source, but it shows unauthorised error (I have full control).

 

Thank you

 

@cju , @fccrous , @kchaluvadi , @vadim_tabakman 

 Could you guys please try to help me

icon

Best answer by Brar 1 March 2022, 00:49

View original

5 replies

Badge +7

Good day Brar, 


 


Once you have the XML in a variable or linked to a field in one of your lists, I would add an Query XML action.  


 


To get you started, I generally make sure I have the XML from either the a log in History action or email the XML to me. 


I copy this xml into the Query XML action and then use the Builder button to give me the string. 



 


Once you pulled in the first item, you will probably assign it to a collection variable.  You can add the the other XML structure elements to the same action by clicking on the "add Output" at the bottom.  


 



After this you can do a normal For each to process all the collection operations. 


 


Let me know if you need more info on a specific step. 


 


Kind Regards, 


Francois


 

Good Day @fccrous ,
Thank you for your reply, I really appreciate your help.
My main issue was I wasn't able to get the right xml of the duplicated item.
But Now, I found a way to get the right XML, and update the duplicated item.

I have used 'copy to sharepoint' action to copy the item in same sharepoint list, and store the url of copied item in as variable.
Then 'update xml' action, in this I use URL to XML as a source, for URL i have provided the variable 'duplicateitem_url' then added ?NoRedirect =true, so my final URL become as:
Duplicateitem_url?NoRedirect=true

and have provided the credentials with contributor permisions.

This is working fine for me to update the xml, and even for getting the xml using 'web request' action.

Really thank you for your suggestion.

Hi @fccrous,

Could you please help me to find out that How we can delete a xml node,
replacing node content in update xml action just replace the content, but I want to delete a node permanently.

Thankyou for your help
Badge +7

Hi Brar, 


Start by making sure the repeating section writes the data to multiple line plain text column in the list (Repeating section connected to this field).


 


To update/delete a specific node, I would split it out into collections and then update/delete the field in the collections or delete the number across the collection that I don't want any more and then rebuild the XML with a "For each"-action and "Build string"-action commands.   At the end I will overwrite the XML that was stored in the existing column.  


 


Let me know if you need more detail on this. 


 


Kind Regards, 


Francois

Thank you fccrous,

Sorry for late reply, Thank you for your help.
I was able to resolve the issue.

Regards,

Reply