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 / Interop / May 2004

Tip: Looking for answers? Try searching our database.

Automating saving encrypted attachments in Outlook 2000 using VB

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
j - 20 May 2004 15:23 GMT
Hi,
After having a look around on various groups I found lots of code to
automate the saving of attachments on mails to folders on the file
system. This was the primary requirement of a client of mine. However,
they have now come back to me to say that the format of the mails will
be changing to SMIME encrypted emails. They are using Outlook 2000 and
have got personal certificates from Thawte and now have an automated
system emailing them mails that are encrypted using these
certificates. I'm trying to work out if I'll be able to access the
attachments if they are encrypted. I've got a personal cert myself now
and I'm coming up against some problems in my code (abridged version
below)

For I = Fldr.Items.Count To 1 Step -1
Set olMi = Fldr.Items(I)        
 For Each olAtt In olMi.Attachments
   On Error Resume Next
   olAtt.SaveAsFile (strPath & olAtt.filename)
 Next olAtt
 olMi.Save
 olMi.Move MoveToFldr
Next I

I'm getting an error on the line of "Set olMi = Fldr.Items(I)"
Run-time error '13':
Type Mismatch

This error doesn't happen when the mail is an unencrypted mail. Does
this mean that encrypted mails are not Outlook.MailItem objects or
what???
Does anyone know whether even if I can get the type right, will I be
able to save the attachment? Normally when I open the mail I get
prompted for a password (this was associated with the cert when I went
through the cert generation process on Thawte.com). How will I be able
to automate this process so that it is invisible to the user?

Any help, ideas, references would be greatly appreciated.

Regards,
Jeremy
Eric Legault [MVP - Outlook] - 27 May 2004 05:35 GMT
What data type is olMi declared as?  When iterating through an Items collection,
it is best to use a variable declared as a generic Object type because
of all the different message types that you can encounter.  Or else check
the .Class property to see what kind of object it is before processing
it further.

Eric Legault - B.A, MCP, MCSD, Outlook MVP
---------------------------------------------
Job:    http://www.imaginets.com
Blog:    http://blogs.officezealot.com/legault/

>Hi,
>After having a look around on various groups I found lots of code to
[quoted text clipped - 36 lines]
>Regards,
>Jeremy
 
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.