AnsweredAssumed Answered

process REST response

Question asked by cvuppala on Jan 19, 2017
Latest reply on Jan 24, 2017 by cvuppala

Hi,

 

I am using below REST end point to get all the attachments of a particular list item and storing them in a collection variable.

 

webURL/_api/web/lists/getbytitle('attachment%20url%20test')/items(1)/AttachmentFiles

 

I would like to iterate through this collection variable so that I can build an HTML string where each attachment name is displayed in its own div and I  can set the resulting HTML value into a rich text field. 

 

Please help.

 

The rest response is of the following format: ( I have FileName and Server Relative Url that I can use to build the string).

 

<?xml version="1.0" encoding="utf-8"?><feed xml:base="http://mysite.com/_api/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml"><id>2806f6ee-06b1-402f-a4cd-5a8d836ca177</id><title /><updated>2017-01-20T00:32:18Z</updated><entry><id>http://mysite.com/_api/Web/Lists(guid'44c55cef-9f28-49dd-9b89-677f493f7c90')/Items(1)/AttachmentFiles('MigrationPlan_01162017.xlsx')</id><category term="SP.Attachment" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" href="Web/Lists(guid'44c55cef-9f28-49dd-9b89-677f493f7c90')/Items(1)/AttachmentFiles('MigrationPlan_01162017.xlsx')" /><title /><updated>2017-01-20T00:32:18Z</updated><author><name /></author><content type="application/xml"><m:properties><d:FileName>MigrationPlan_01162017.xlsx</d:FileName><d:ServerRelativeUrl>/sites/techwriters/OneNote/Lists/attachment url test/Attachments/1/MigrationPlan_01162017.xlsx</d:ServerRelativeUrl></m:properties></content></entry></feed>

Outcomes