Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Programming VBA / July 2005

Tip: Looking for answers? Try searching our database.

Moving bounce notices to PST file fails

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Steve Roberts - 22 Jul 2005 17:49 GMT
I have a program that moves email from a public folder to a .PST file if the
email is older than X. The problem I am having is that the users have
decided that they should put any bounced email messages into the public
folder as well. When my program tries to move the bounce back message, it
errors 424 Object Required.  The program works on everything else. Are the
bounce back messages not actually a message object?

Any Ideas?

Thanks

Steve
Dmitry Streblechenko - 22 Jul 2005 19:01 GMT
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

>I have a program that moves email from a public folder to a .PST file if
>the email is older than X. The problem I am having is that the users have
[quoted text clipped - 8 lines]
>
> Steve
Steve Roberts - 22 Jul 2005 19:44 GMT
  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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.