Copying large numbers of items

T

Tim

I would appreciate help copying large numbers of items, or
large folders - we have customer files with ca. 10,000
items. If I copy them directly, we lose a dozen or so each
time - I recall this is referred to in SM's Jumpstart book
as a known OL Memory Leak. (I can't copy the whole folder
because I am copying out of a .ost file). So following
advice in the SM's book (I think), and plagiarising some
of the code there, I have tried using CDO, but don't quite
seem to be able to get it to write the record. Here's the
relevant code..


Set objApp = CreateObject("Outlook.Application")
Set objNS = objApp.GetNamespace("MAPI")
Set objSourceFolder = objNS.PickFolder
Set objTargetFolder = objNS.PickFolder
If Not objFolder Is Nothing Then
Call DoCDOLogon
Set objCDOSourceFolder = g_CDOSession.GetFolder
(objSourceFolder.EntryID, objSourceFolder.StoreID)
Set objCDOTargetFolder = g_CDOSession.GetFolder
(objTargetFolder.EntryID, objTargetFolder.StoreID)
Set colCDOSourceContacts =
objCDOSourceFolder.Messages
For Each objCDOMessage In colCDOSourceContacts
Set objNewCDOMessage = objCDOMessage.CopyTo
(objCDOTargetFolder.FolderID, objTargetFolder.StoreID)
objNewCDOMessage.Update
Next
Call DoCDOLogoff

The problem is in the For - Next loop; it seems to go
through the motions of saving the new item, but nothing
appears in the folder. Help much appreciated.

Thanks
 

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