Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to open attachment

0 views
Skip to first unread message

milop

unread,
Dec 4, 2009, 12:20:10 PM12/4/09
to
Hello.

I originally made this post to the sharepoint.development_and_programming
group, but perhaps this is a better place for it.

Using .Net 3.0, Sharepoint 2007, I wrote a webpart that displays an Exchange
Inbox within a datagrid. Sounds stupid, but there are reasons for it.

If an Inbox email has an attachment I need to open the attachment. So, if
it's a Pdf, I want to create a link so that when the user clicks it the Pdf
opens.

In a regular web app that I wrote to do this same thing, the attachment link
pointed to a different .aspx page, passing it the "Key" of the attachment,
and that page would retrieve the attachment as a byte array, set the
response content type to the appropriate one (application/pdf in this
example), and write the binary back to the web browser. The Pdf would then
open.

How do I now do this with this webpart and Sharepoint? As it stands now, I
am writing an <a href> just so I can see the attachment name, but I don't
know what to point the href to, or even if I should be using and href.

Any have any ideas?

Thanks in advance,

Mike


Mike

unread,
Dec 10, 2009, 6:28:01 PM12/10/09
to
You won't be able to handle this using just a Web Part. You can include your
original ASPX page (either directly in the SharePoint site, or in the
_layouts folder), or, use an HttpHandler/HttpModule. If it were me I would go
with the latter route.

"milop" wrote:

> .
>

milop

unread,
Dec 11, 2009, 12:59:18 PM12/11/09
to
Hi, Mike. Thanks for responding.

If I use the former (.aspx page). Putting a page in the "_layouts" folder
makes the page accessible to the whole sharepoint site?

Thanks again,

Mike

"Mike" <Mi...@discussions.microsoft.com> wrote in message
news:17B5E440-A7D7-4B39...@microsoft.com...

0 new messages