2

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?

2
  • 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
    Commented Nov 23, 2011 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
    Commented Nov 24, 2011 at 4:47

1 Answer 1

3

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 :)

2
  • That was great Gavin :) Let me try this :)
    – Jithu
    Commented Nov 24, 2011 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
    Commented Dec 2, 2011 at 4:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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