Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Programming VBA / May 2008

Tip: Looking for answers? Try searching our database.

Reconstructing Outlook emails with attachments from SQL Blobs

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
JW - 14 May 2008 15:05 GMT
I have a SQL database with the Outlook message saved to a blob without the
attachments.  The attachments are saved to separate rows in another table.  I
would like to reconstruct the message with the attachments.  If I extract the
message to a .msg file, the attachments are missing.  They were somehow
stripped off. I can also extract the attachments separately.  I would like to
be able to reconstruct the whole message, including attachments, to be able
to display it in Outlook so the user can click on the attachment icons in the
email and display it.  Anybody got any ideas as to how to code this (C#
preferred).  - Thanks in advance
Dmitry Streblechenko - 14 May 2008 17:47 GMT
Import the mesage to Outlook, then add attachments using
MailItem.Attachments.Add.
Are you simply saving the messages as MSG files so that users can open them
from Windows Explorer or import them to Outlook?

Signature

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy  - Outlook, CDO
and MAPI Developer Tool
-

>I have a SQL database with the Outlook message saved to a blob without the
> attachments.  The attachments are saved to separate rows in another table.
[quoted text clipped - 10 lines]
> email and display it.  Anybody got any ideas as to how to code this (C#
> preferred).  - Thanks in advance
JW - 14 May 2008 18:44 GMT
> Import the mesage to Outlook, then add attachments using
> MailItem.Attachments.Add.
> Are you simply saving the messages as MSG files so that users can open them
> from Windows Explorer or import them to Outlook?

The messages are blobs in the database so that they can be linked to other
database rows/objects.  They are being exported from the database to msg
files so that they can be displayed in Outlook interface in their original
format.  If we could "stream" them directly to the Outlook interface, that
would be even better that exporting them into msg files first.  How to I
import the blob direcly into Outlook?  In addition, the msg file already
shows that the attachment is there, except when you click on it, it really
isn't there.  If I do an Attchment.Add, won't there now be two copies of the
attachment showing, one that works and one that doesn't?
Dmitry Streblechenko - 14 May 2008 19:27 GMT
You could use Aplication.CreateItemFromTemplate, but it wipes out the sender
related data and the message is created in the unsent state. You could use
Redemption to import them (RDOFolder.Items.Add / RDOMail.Import).
What do you mean by "msg file already shows that the attachment is there,
except when you click on it, it really  isn't there"?
On the low level, were the attachments left in place by PR_ATTACH_DATA_BIN
property removed (look at the MSG file with OutlookSpy - click Misc |
OpenIMsgOnIStg)?

Signature

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy  - Outlook, CDO
and MAPI Developer Tool
-

>
>> Import the mesage to Outlook, then add attachments using
[quoted text clipped - 13 lines]
> the
> attachment showing, one that works and one that doesn't?

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.