Sharepoint List item get the attachment url

private string getAttachmentsUrl(int id,SPList listname,SPWeb myweb)
{
string url = string.Empty;
SPListItem myListItem = listname.GetItemById(id);
foreach (String attachmentname in myListItem.Attachments)
{
url =
myListItem.Attachments.UrlPrefix
+ attachmentname;
// SPFile attachmentFile = myweb.GetFile(attachmentAbsoluteURL);
}
return url;
}

Leave a Reply

Your email address will not be published. Required fields are marked *

Bitnami