SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

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

I have a SharePoint 2010 list, which has attachments!!

I am using a custom grid-view to display some selected List fields from the list.

I would like to include the attachment as an embedded document in the Grid-view, Is that possible?

share|improve this question
Can you clarify what you mean by embedded document? Do you just want to include a link to the attachment in the grid? – Kit Menke Nov 23 '11 at 15:15
@KitMenke I thought I will show the file in a cell, not the content. On double click of the file would like to open it in word document !! Is that possible? – Jithu Nov 24 '11 at 4:47
up vote 2 down vote accepted

Assuming you're working in server side code:

Take a look a the Attachments property of the SPListItem, it returns an SPAttachmentCollection, from there itterate the SPFiles and use the Url property to get the site relative path and you should be sorted from there.

Some times the docs on MSDN are actually quite helpful :)

share|improve this answer
That was great Gavin :) Let me try this :) – Jithu Nov 24 '11 at 8:31
Hi Gavin got this worked!! Created an Itemtemplate with anchor control to Image then set the HREF property of the anchor tab to the retrieved attachment URL ... – Jithu Dec 2 '11 at 4:02

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.