|
 |
asp_cdo thread: Rendering Attachments using CDO
Message #1 by stephen.shek@s... on Mon, 9 Jul 2001 09:31:46
|
|
Hi there,
I am having a problem dowmloading attachments, from our Exchange server,
to an ASP using CDO rendering lib.
The attachments download okay, but when they open they seem to be
corrupted, mainly word and PDF.
any help would be greatly appreciated
THX steve
Message #2 by "Siegfried Weber" <sweber@c...> on Mon, 9 Jul 2001 13:48:53 +0200
|
|
http://www.cdolive.com/cdo5.htm and http://www.cdolive.com/asp7.htm does
have some pointer. Also http://www.cdolive.com/discussion.htm is a full
fledged sample which supports attachment download you might want to look
at.
<Siegfried />
> -----Original Message-----
> From: stephen.shek@s... [mailto:stephen.shek@s...]
> Sent: Monday, July 09, 2001 11:32 AM
> To: ASP CDO
> Subject: [asp_cdo] Rendering Attachments using CDO
>
> Hi there,
> I am having a problem dowmloading attachments, from our Exchange
server,
> to an ASP using CDO rendering lib.
> The attachments download okay, but when they open they seem to be
> corrupted, mainly word and PDF.
>
> any help would be greatly appreciated
>
> THX steve
>
Message #3 by stephen.shek@s... on Mon, 9 Jul 2001 16:55:19
|
|
>Hi Siegfried,
Have implemented the code from www.cdolive.com/cdo5.htm and had a look at
http://www.cdolive.com/asp7.
However http://www.cdolive.com/discussion.htm is down or not accessible
just now.
The real problem I am having seems to be the inability of my code to
process binary data, as it has no problems whatsoever with text and HTML
documents in rendering them.
this is a sample of my code:
Set objAttachColl = objMsg.Attachments
If objAttachColl Is Nothing Then
Response.Write "unable to set Attachments collection"
Else
Response.Write "Attachments count for this msg: " &
objAttachColl.Count & "<BR>"
iAttachCollIndex = 0 ' reset global index variable
End If
iAttachCollIndex = 1
Set objAttachment = objAttachColl.Item(iAttachCollIndex)
' MAPI property for attachment binary data
Const CdoPR_ATTACH_DATA_BIN = &H37010102
bstrFileName = objAttachment.Name
Response.Write bstrFileName
Response.AddHeader "Content-Disposition","attachment;filename=" +
bstrFileName
Set objRenderApp = Server.CreateObject("AMHTML.Application")
Set objRend = objRenderApp.CreateRenderer(2)
Set objRenderAtt = objRend
objRenderAtt.DataSource = objAttachment
objRend.RenderProperty CdoPR_ATTACH_DATA_BIN , 0, Response
set objRend = Nothing
set objMsg = Nothing
set objAttachment = Nothing
set objTopFolder = Nothing
set objSession = Nothing
objSession.Logoff
Do I need to set any other parameter, in order for the binary data stream
to be rendered.
many thnx
Steve
http://www.cdolive.com/cdo5.htm and http://www.cdolive.com/asp7.htm does
> have some pointer. Also http://www.cdolive.com/discussion.htm is a full
> fledged sample which supports attachment download you might want to look
> at.
>
> <Siegfried />
>
> > -----Original Message-----
> > From: stephen.shek@s... [mailto:stephen.shek@s...]
> > Sent: Monday, July 09, 2001 11:32 AM
> > To: ASP CDO
> > Subject: [asp_cdo] Rendering Attachments using CDO
> >
> > Hi there,
> > I am having a problem dowmloading attachments, from our Exchange
> server,
> > to an ASP using CDO rendering lib.
> > The attachments download okay, but when they open they seem to be
> > corrupted, mainly word and PDF.
> >
> > any help would be greatly appreciated
> >
> > THX steve
> >
Message #4 by "Siegfried Weber" <sweber@c...> on Tue, 10 Jul 2001 14:01:54 +0200
|
|
Wrong link, sorry. The correct should be:
http://www.cdolive.com/discussionforum.htm
As far as I can see its the same code I used in the sample above and it
works here.
<Siegfried />
> -----Original Message-----
> From: stephen.shek@s... [mailto:stephen.shek@s...]
> Sent: Monday, July 09, 2001 6:55 PM
> To: ASP CDO
> Subject: [asp_cdo] RE: Rendering Attachments using CDO
>
> >Hi Siegfried,
> Have implemented the code from www.cdolive.com/cdo5.htm and had a
look at
> http://www.cdolive.com/asp7.
> However http://www.cdolive.com/discussion.htm is down or not
accessible
> just now.
> The real problem I am having seems to be the inability of my code to
> process binary data, as it has no problems whatsoever with text and
HTML
> documents in rendering them.
>
> this is a sample of my code:
> Set objAttachColl =3D objMsg.Attachments
> If objAttachColl Is Nothing Then
> Response.Write "unable to set Attachments collection"
>
> Else
> Response.Write "Attachments count for this msg: " &
> objAttachColl.Count & "<BR>"
> iAttachCollIndex =3D 0 ' reset global index variable
> End If
>
> iAttachCollIndex =3D 1
> Set objAttachment =3D objAttachColl.Item(iAttachCollIndex)
>
> ' MAPI property for attachment binary data
> Const CdoPR_ATTACH_DATA_BIN =3D &H37010102
>
> bstrFileName =3D objAttachment.Name
> Response.Write bstrFileName
> Response.AddHeader "Content-Disposition","attachment;filename=3D" +
> bstrFileName
> Set objRenderApp =3D Server.CreateObject("AMHTML.Application")
> Set objRend =3D objRenderApp.CreateRenderer(2)
> Set objRenderAtt =3D objRend
> objRenderAtt.DataSource =3D objAttachment
>
> objRend.RenderProperty CdoPR_ATTACH_DATA_BIN , 0, Response
>
> set objRend =3D Nothing
> set objMsg =3D Nothing
> set objAttachment =3D Nothing
> set objTopFolder =3D Nothing
> set objSession =3D Nothing
> objSession.Logoff
>
> Do I need to set any other parameter, in order for the binary data
stream
> to be rendered.
>
> many thnx
> Steve
>
|
|
 |