View Single Post
  #8  
Old December 7th 06, 09:44 PM posted to microsoft.public.outlook.program_vba
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default Redemption Inbox problem + instability

What is the *exact* error?
How do you decide which items get copied where? Your code will not copy the
first half of the items, it will copy every second one.
Also note that your code will be a lot tmore efficient if you cache the
value of FolderItemsRED.Items rather than call it on each step of the loop;
you will get a brand new COM object each time.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"mirzoni" wrote in message
...

Hi Dimirty,

Man, thanks for that!

This worked:
session.MAPIOBJECT = oNS.MAPIOBJECT
(now it totally makes sense)

Now i've got stuck on the next part!
In this app, after login, i create a new folder: rootscanned(date and
time)
and place the redemption mailitems one by one in that folder... simple
right?

When I used the session.LogonExchangeMailbox(MailBoxName, Server) I
could execute the move however now I can not.

..
session.MAPIOBJECT = oNS.MAPIOBJECT
Dim ScanFolder As Redemption.RDOFolder

Dim DateAndTimeNOW As String
DateAndTimeNOW = Now()
ScanFolder =
session.Stores.DefaultStore.IPMRootFolder.Folders( "Scanned").Folders.Add(DateAndTimeNOW)

Dim FolderItemsRED As Redemption.RDOFolder
FolderItemsRED = session.GetDefaultFolder(6)

Dim MailTo As Redemption.RDOMail
For i = 1 To FolderItemsRED.Items.Count
MailTo = FolderItemsRED.Items(i)
MailTo.Move(ScanFolder)
next i
...
the app dies on: MailTo.Move(ScanFolder)

please disregard the fact that when the "i' gets to
(FolderItemsRED.Items.Count/2) that the app will break.
this is because items are getting moved to another folder so the "i"
reference will go above the actual count. I have another more complex
routine that handles that issue but in this case I have shortened it
for the purpose of clarity and getting to the bottom of why does the
app break on:
MailTo.Move(ScanFolder).

please help


--
mirzoni
------------------------------------------------------------------------
mirzoni's Profile: http://www.officehelp.in/member.php?userid=5392
View this thread: http://www.officehelp.in/showthread.php?t=1277781

Posted from - http://www.officehelp.in



Ads