Speed up moving items

G

Guest

I'm trying somehow to imitate Gmail feature, which moves archived items back
into the Inbox when a new email with the same subject line arrives.
I have implemented following which will be called each time an email arrives
and moves all emails with same Conversation topic back to the Inbox. It seems
to work, but takes very long with only 1400 items in my Archive folder. Any
idea how I can speed this up?
Thanks
Kemal

Sub Test()
MoveEmails ("Considered test defects")
End Sub

Sub MoveEmails(myConvTopic As String)
Dim persFolders, myArchiveFolder, myDestFolder As Outlook.MAPIFolder
Dim i As Integer
Dim myItem As Outlook.MailItem
Set myDestFolder = Application.Session.GetDefaultFolder(olFolderInbox)
Set persFolders = Application.Session.Folders.Item(3)
Set myArchiveFolder = persFolders.Folders.Item(7)
mailCount = myArchiveFolder.Items.Count
For i = mailCount To 1 Step -1
If myArchiveFolder.Items(i).Class = olMail Then
Set myItem = myArchiveFolder.Items(i)
If myItem.ConversationTopic = myConvTopic Then
myItem.Move myDestFolder
End If
End If
Next
End Sub
 
G

Guest

Thanks a lot for the link.
I started but got stuck when trying to access the "_myArchive" folder in
"Personal Folders":

......
Set myRDOSession = CreateObject("Redemption.RDOSession")
myRDOSession.Logon

Set myRDODestFolder = myRDOSession.GetDefaultFolder(olFolderInbox)
Set myRDOArchiveFolder =
myRDOSession.Stores.DefaultStore.IPMRootFolder.Folders("_Archive")
I also would appreciate if you could look at the code below. I couldn't
test it yet.

mailCount = myRDOArchiveFolder.Items.Count

For i = mailCount - 1 To 1 Step -1
If myRDOArchiveFolder.Items(i).Class = olMail Then
Set myRDOItem = myRDOArchiveFolder.Items(i)
ct = ct + 1
If myRDOItem.ConversationTopic = myConvTopic Then
ct2 = ct2 + 1
'myRDOItem.Move myDestFolder
End If
End If
Next
End Sub

<<<<<<<<

Thanks
Kemal
 
M

Michael Bauer

Am Fri, 26 May 2006 09:41:02 -0700 schrieb Kemal:

According to your previous sample you should get access to the folder
"_Archive" - as long as it´s the correct name and if it´s contained within
your default store.

Except you don´t actually want to process also the last item, your loop must
start at mailCount, not mailCount-1.

The RDOMail doesn´t support a Class property but a MessageClass. Because
RDOMail is able to access every item in your Inbox, you maybe don´t need to
check the item type first?

So the code could look like this:

Dim Items as RdoItems
Dim Mail as RdoMail
Set Items=myRdoArchiveFolder.Items
For i=Items.Count to 1 Step -1
Set Mail=Items(i)
' if necessary for your logic you can check the MessageClass
' property here
Next
 

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