accessing outlook by oledb

  • Thread starter Thread starter André Dias
  • Start date Start date
A

André Dias

Hello,

how can I get the attachments from messages from outlook by Oledb ?

the code below, returns the subject, to, from, it also returns a flag
informing if the messages have attachment , but I don't know how to get it.

OleDbConnection conn = new OleDbConnection
("Provider=Microsoft.Jet.OLEDB.4.0;Outlook 9.0;MAPILEVEL=Personal
Folders|;PROFILE=Outlook;TABLETYPE=0;DATABASE=C:\\Windows\\Temp");
OleDbDataAdapter da = new OleDbDataAdapter("SELECT * FROM Teste", conn);
da.Fill(ds, "Outlook");
dt = ds.Tables["Outlook"];
dataGrid1.DataSource = dt;

tks

[]s

André
 
I don't believe you can get attachments from an OLEDB connection to Outlook.
In fact the fields you get are quite limited. For example there are only 44
fields available for a contact item and in the Outlook object model a
contact has far more properties than that. You might have to use Outlook
object model code to do what you want.

In addition, unless you are using Extended MAPI and getting the attachments
from the AttachmentTable you more or less have to save each attachment to
the file system to do any work with it.
 
Back
Top