Processing Email Messages in .pst, changing email addresses

A

akumar

I am trying to process .pst files with years or archived email. Many of the
email messages came from backing-up email that I received on Microsoft
Exchange servers.

As a result, many of the messages have Sender, and Recipient email addresses
stored in "EX" format.

I would like to process these .pst files and change the "EX" email addresses
to some "SMTP" like string (and change the type to "SMTP") so that I can
import into gmail.

I can locate the message, I can locate the addresses, BUT all of the
Recipient objects are read-only.

I am not trying to send email as another user, or add other users to a
message; just change the TYPE and Email Address so that the import to GMAIL
(through IMAP) works correctly.

How do I go about doing this.

As a point of reference, here is some code ... Procedure below will
recursively process folders, assume that it is called with some top level
folder. I'm looking for code to stick in the place that has the comment 'Fill
in code here ...

Public Sub ProcessFolder(ByVal pFolder As Outlook.MAPIFolder)
Dim lSubFolderList As Outlook.Folders
Dim lSubFolder As Outlook.MAPIFolder
Dim lItems As Outlook.Items
Dim lItem As Object
Dim lMailItem As Outlook.MailItem

Set lSubFolderList = pFolder.Folders
Set lSubFolder = lSubFolderList.GetFirst

Do While Not lSubFolder Is Nothing
Call ProcessFolder(lSubFolder)
Loop

Set lItems = pFolder.Items
For Each lItem In lItems
If (lItem.Class = olMail) Then
Set lMailItem = lItem
' Fill in code here ...

End If
Next
End Sub
 
K

Ken Slovak - [MVP - Outlook]

You would have to add new recipients with the desired characteristics and
remove the existing ones.
 
A

akumar

Awesome, I'll use that for To, CC and BCC. Can you help me with the
SenderAddress. I suspect that this technique won't work for SenderAddress.

-ak
 
K

Ken Slovak - [MVP - Outlook]

Do you mean SenderEmailAddress? That's a read-only string property, not much
you can do about that.
 
A

akumar

Well, as it turns out, the suggestion re other recipients was also not
workable. In order to save the changes, I have to call lMailItem.Save which
promptly resets the dates on the message.
 
K

Ken Slovak - [MVP - Outlook]

Of course you have to save any changes to make them persistent, and that
will change dates. There's really no way to change an item in any way
without changing various date properties.
 

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