Help With A Simple Script?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I get a tiny amount of space on the Exchange Server. I constantly have to
clean out my Inbox, SentItems and Deleted Items folders to keep from getting
those "over limit" messages.

But I really like to hang onto these things longer than my server space
allows.

So I've written a little macro that moves messages out of my Deleted Items
folder and into a Personal folder. It works great, but with one little
glitch. Meeting Notices end up in my Drafts folder.

Here it is:

Option Explicit

Sub Move_Deleted()

On Error GoTo Handler

Dim objNS As NameSpace
Dim objPF As MAPIFolder
Dim objDl As MAPIFolder

Dim objItem As Object
Dim Total As Integer
Dim Index As Integer

Call MsgBox("Moving DeletedItems...", vbInformation, "Move_Deleted")

Set objNS = Application.GetNamespace("MAPI")

Set objPF = objNS.Folders.Item("Personal Folders"). _
Folders.Item("Saved"). _
Folders.Item("Deleted")

Set objDl = objNS.GetDefaultFolder(olFolderDeletedItems)

Total = objDl.Items.Count
For Index = Total To 1 Step -1

' Mark the item "read"
objDl.Items(Index).UnRead = False

' Move it
objDl.Items(Index).Move objPF

Next Index

Set objPF = Nothing
Set objDl = Nothing
Set objNS = Nothing

Exit Sub

Handler:

Call ReportError("Move_Deleted", Err)

End Sub ' Move_Deleted

Can anyone tell me what I've done to cause Meeting Notices to end up in my
Drafts folder?

Thanks,
Mike
 
Does it do the same thing if you don't set the Unread property? Just a guess.

Regardless, you can save yourself the coding effort by configuring the
AutoArchive settings to move messages in specified folders to your .pst at
specified time intervals.
 
Back
Top