PC Review Forums Newsgroups Microsoft Outlook Microsoft Outlook VBA Programming Detect the marked for deletion property

Reply

Detect the marked for deletion property

 
Thread Tools Rate Thread
Old 15-03-2006, 11:28 PM   #1
davecoleman@gatech.edu
Guest
 
Posts: n/a
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

  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

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