Jignesh Rajput
Jignesh Rajput

Reputation: 3558

How to retrieve attachement file From Custom list sharepoint2010?

I have create custom list..and submit Form data onto list by Visual webpart.but i have doubts when i have attach on the attachments of list. now a time to retrieve Data from custom list but how can i retrieve attachement file from list and easy to download by End user??? Plz anyone guard me

Upvotes: 0

Views: 595

Answers (1)

SPFolder folder = web.Folders["Lists"].SubFolders[list.Title].SubFolders["Attachments"].SubFolders[listitem.ID.ToString()];

Then you can do:

foreach (SPFile file in folder.Files)
{
    // Do what you want to do with the file
}

Upvotes: 0

Related Questions