2
votes

I have a SharePoint 2013 list with few fields like EmpId,EmployeeFirstName,EmployeeLastName,DOB and for each employee, I add image as an attachment to each row. Now I want to pull the data of every employee with the attachment.

Is it possible to get the employee list data including attachments in one REST API call?

https://kuldeep.sharepoint.com/TQA/_api/web/lists/getbytitle(%27EmployeeList%27)/Items(3)/AttachmentFiles

Thanks, Kuldeep

2

2 Answers

3
votes

Sure, specify AttachmentFiles field as a projected field, using the $select and $expand query options.

For example:

/_api/lists/getByTitle('<list title>')/items?$select=Title,AttachmentFiles&$expand=AttachmentFiles
0
votes
 /_api/web/lists/getbytitle('list name')/items?$select=Title,AttachmentFiles&$expand=AttachmentFiles 

will provide FileName and ServerRelativeUrl.