A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Detect the marked for deletion property



 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old March 16th 06, 12:28 AM posted to microsoft.public.outlook.program_vba
[email protected]
external usenet poster
 
Posts: 1
Default Detect the marked for deletion property

I am using an IMAP email with Outlook 2003 and I don't know how to
detect if an email is "marked for deletion" (has a line through it).
IMAP folders are weird in that when you click Delete, it doesn't
actually go anywhere, it just gets a line through it. You then have to
click "Purge Deleted Messages" to really get rid of it. I want to be
able to run a script that finds all the messages that have been found
to be set for deletion, so that I can move them to a different folder
first.

Thanks!

Example Code:
----------------------------------------------------------
Sub MoveOldItems()
Dim olns As Outlook.NameSpace
Dim oConItems As Outlook.Items
Dim iNumItems As Integer

Set objNS = Application.GetNamespace("MAPI") '"Saved Emails"
Set oInboxItems = objNS.GetDefaultFolder(olFolderInbox).Items

Set objMainFolder = objNS.Folders("Personal Folders")
Set objTargetFolder = objMainFolder.Folders("Saved Emails")
Set Application.ActiveExplorer.CurrentFolder = objTargetFolder

iNumItems = oInboxItems.Count

For I = iNumItems To 1 Step -1
Set objCurItem = oInboxItems.Item(I)

If TypeName(objCurItem) = "MailItem" Then
' Move only mail messages

!!!!!----This is the part that I don't know how to do:
If objCurItem.MarkedForDelete Then
!!!!!------------------------------------------------------------------
objCurItem.Move objTargetFolder
End If
End If
Next

MsgBox "Finished moving items."

Set objInboxItems = Nothing
Set objTargetFolder = Nothing
Set objNS = Nothingessag

End Sub

 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Appointment Recurrence Deletion ZZMHume Outlook - Calandaring 1 March 15th 06 05:15 PM
how to detect programmatically if some code is runing in wordmail Herve cadieu Outlook and VBA 5 March 14th 06 04:36 PM
Junk E-mail folder stays in bold even after all messages marked as read Ric Outlook - General Queries 7 February 8th 06 01:53 AM
Automatic Deletion of Older New Group Messages? CWLee Outlook Express 5 January 29th 06 11:00 PM
Auto Detect Connection Jonathan Outlook - Installation 0 January 27th 06 10:21 AM


All times are GMT +1. The time now is 08:42 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.