Skip to main content

How to retrieve the url of the attachment associated with the list item?

Dudes,
          It is very simple.Before I tried in many ways.I felt this one is the simple approach.Once after you get the listItem ,ie.SPListItem follow the procedure as shown below.

string name=string.Empty;
splistitem item=list.GetItems(queryItems)[0];
foreach(string file in item.Attachments)
{
    name=item.Attachments.UrlPrefix+file; 
}
 return name;


Comments