They are ReportItem objects, not MailItem in the Outlook Object Model.
What is the code?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Private Sub ProcessFolder(CurrentFolder As Outlook.MAPIFolder,
RestrictDate As Date)
Dim olNewFolder As Outlook.MAPIFolder
Dim olTempItem As Object
Dim myOlApp As New Outlook.Application
Dim myNS As Outlook.NameSpace
Dim myRestrictItems As items
Dim fldNew As Outlook.MAPIFolder
Dim intcount As Integer
Dim I As Long
Set olNewFolder = CurrentFolder
Set olTempItem = CurrentFolder.items
Set myOlApp = CreateObject("Outlook.Application")
Set myNS = myOlApp.GetNamespace("MAPI")
Set myRestrictItems = olTempItem.Restrict("[ReceivedTime] < '" &
RestrictDate & "'") 'olTempItem.Restrict("[ReceivedTime] < '1/2/2004'")
Set fldNew = myNS.Folders(CurrentFolder.Name)
If myRestrictItems.Count = 0 Then Exit Sub
intcount = myRestrictItems.Count
For I = intcount To 1 Step -1
Set olTempItem = myRestrictItems(I)
'********************************************
'If the Flag Status was changed in the user's inbox then the email
is moved to the public folders outlook thinks the item hasn'e been processed
and throws an error
If olTempItem.FlagStatus > 0 Then olTempItem.FlagStatus = 0
'********************************************
'****************************************************
'Here is the move code
olTempItem.Move (fldNew)
'****************************************************
Next
End Sub
> They are ReportItem objects, not MailItem in the Outlook Object Model.
> What is the code?
[quoted text clipped - 16 lines]
>>
>> Steve
Dmitry Streblechenko - 25 Jul 2005 04:03 GMT
Works just fine here. Do you mean the error happens at the Move() line or at
some later time?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
> Private Sub ProcessFolder(CurrentFolder As Outlook.MAPIFolder,
> RestrictDate As Date)
[quoted text clipped - 61 lines]
>>>
>>> Steve