SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How to get Attachment Full URL Programatically From Sharepoint ListItem?


I have adding new item with attachment. Now i have to bind that attachment link to grid. When click on that link Attachment should be open.

How can i get Attachment url of that record?

share|improve this question
up vote 4 down vote accepted

I found answer for my question.

private string GetAttachmentUrls(SPListItem oItem)

        string path = string.Empty;



            path = (from string file in oItem.Attachments
                              orderby file
                              select SPUrlUtility.CombineUrl(oItem.Attachments.UrlPrefix, file)).FirstOrDefault();
            return path;
            return string.Empty;

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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