1

I am trying to obtain the full URL of every item's attachments in a sharepoint list

Here is what I am specifically trying to obtain, in bold:

site.sharepoint.com/sites/mysite/Lists/ContactList/Attachments/1/PhotoName1.jpg

site.sharepoint.com/sites/mysite/Lists/ContactList/Attachments/1/PhotoName2.jpg

I am trying to find every filename within each item's attachment section.

So far I am pulling it out like so:

var AttachmentPic1 = ListURL + '/Attachments/' + StaffList[i].ID + 'Photo.png';

Which works, but the name of the photo must be predetermined (Photo.png). Is there any way to pull out each attachment name for each item in the list? My end goal is to be able to extract the full URL for each item in the attachments list to display it in HTML

Thanks ahead of time for any help! I'll be nearby if I didn't explain something right

2 Answers 2

1

SPServices GetAttachmentCollection will allow you to do this using JQuery.

6
  • Is this possible outside of JQuery? Commented Mar 17, 2016 at 19:30
  • Probably, @Christopher. What language are you wanting to use?
    – Erin L
    Commented Mar 17, 2016 at 19:33
  • C# would be great Commented Mar 17, 2016 at 19:36
  • stackoverflow.com/questions/6525476/…
    – Erin L
    Commented Mar 17, 2016 at 19:36
  • Thank you miss Erin! Can I ask what you searched to find this? Commented Mar 17, 2016 at 19:41
0

Map your list attachments folder as a network drive and then use powershell and run the following script.

Get-ChildItem site.sharepoint.com/sites/mysite/Lists/ContactList/Attachments/ -Recurse | % { $_.FullName } | Out-File C:\Users\username\Desktop\resulsts.txt

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.