Importing Email

D

Derek Hart

Using, dotnet, I am importing emails to just load into a datatable. The one
type of email I am not sure how to handle better is an email that has a
digital signature, and in Outlook, the digital signature is not verified. I
found this out when trying to import 5000 emails into a database, and it
happened to hit this one. I have the following line of code:

MailBody = objMailItem.Body

It errors on this line, when this signature exists. Other than simply
trapping this error and moving past it, is there a way to detect this
digital signature (and I am not sure what would happen if the digital
signature was properly verified), and better trap for this error?
 
K

Ken Slovak - [MVP - Outlook]

Trap it and move along. You can't do much at all with signed messages.
 
D

Derek Hart

Thanks Ken...



I am using code this way to loop through mail items. It seems that this
avoided running into meetings and some other things. And then I mentioned
below the digital signature issue. Is there any other type of email item
that I should trap for, that will error by reading any of the properties of
the MailItem ?



Dim GenericOutlookItem as Object

For Each GenericOutlookItem In objFolder.Items

If TypeOf GenericOutlookItem Is Outlook.MailItem Then

objItem = CType(GenericOutlookItem, Outlook.MailItem)

End if

Next



I want to code for Outlook 2003 and higher, and I am thinking of getting
your book. But all I am doing is simple synchronization with Email and
Contacts. Is there a lot of extras in your book about doing this in a safer
way, and does your book highlight areas where I would need to not use
Outlook 2007 specific code so I can stay at the lowest common denominator of
Outlook 2003?
 
K

Ken Slovak - [MVP - Outlook]

There really isn't too much you can do except trap errors reading properties
of an item. Outlook will return "IPM.Note" as the MessageClass of the item
even though it's actually something like "IPM.Note.SMIME", and will hide
other information about signed/encrypted status.

Other things can also prevent reading a body, for example if digital rights
management has been applied to the item.

My book is centered on Outlook 2007, and covers a lot of the new stuff in
that version.

The general tips and tricks and common techniques are Outlook 2003
appropriate, but you'd need to filter out the 2007 object model stuff. The
sample projects and templates can be used with Outlook 2003 as the base
level version, but you'd need to remove all the Outlook 2007 specific stuff
such as custom task panes, etc. You'd also need to handle the ribbon
differently.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top