Copy a MAPI item to a PST

S

Scupper

I am doing large searches through our Exchange store and copying the
messages to a subfolder of my Inbox using VB.NET. The problem with this is
that each time it copies a message, Exchange wants to virus scan it and the
server admin does not think he can disable that just for this process. So,
I am trying instead to copy the messages to a PST file I have set up on my
workstation.

Unfortunately, I cannot seem to get MAPI to talk to the PST file. Only
Outlook (2000)-based calls will go to it, but Outlook refuses to allow me
to edit items I create, nor will it copy the messages if they are passed to
it in MAPI.Message form.

I have tried:

oItem = MAPI.Message (passed into the function)


Dim oCopy As Outlook.MAPIMessage
oCopy = oWorkingFolder.Items.Add()

oCopy.Sender = oItem.Sender (gives me a message that
Outlook.MAPIMessage.Sender is read-only)


I have also tried:

oItem.CopyTo(sFolderID,sStoreID)

Passing what outlook returns as the folder and store ID, but MAPI then
cannot find the folder.



Any help would be much appreciated.
 
K

Ken Slovak - [MVP - Outlook]

When you say MAPI do you mean CDO 1.21? If so you can't just assign an
Outlook item to a CDO item. You have to get the EntryID of the item and
possibly the StoreID of the MAPIFolder where the item lives and use CDO's
Session.GetMessage(strEntryID, strStoreID) method.

The CDO CopyTo method would use the Outlook MAPIFolder.EntryID and StoreID
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