Thanks to Paul Smerdon and others, I have streamlined my ‘Delete emails’ agent. However, we have soft deletions enabled so the deleted emails show up in each user’s Trash folder. I know how to remove them one at a time from the Trash folder. However, this seems inefficient and time-consuming. I think I can remove them all at once using the “RemoveAllFromFolder” method but I can’t figure out how to set my collection = to the Trash folder docs.
From the Help:
Set collection = db.FTSearch( “cayenne”, 20 )
Call collection.RemoveAllFromFolder( “Recipes\Spicy” )
So here’s what I have so far:
Set Db = Dbdir.GetFirstDatabase( DATABASE )
SearchString$ = | Form = (“Memo” : “Reply”) & @Date(PostedDate) < @Date(@Adjust(@Today; 0;0;-96;0;0;0)) |
While Not( Db Is Nothing )
If Instr( Db.filepath, “Mail”) <> 1 Then
Call Db.Open( “”,“” )
’ Opens currently-selected DB from DbDirectory.
Set docColl = Db.Search( SearchString$, dt, 0 )
Count = docColl.Count
Call docColl.RemoveAll( True )
Call docColl.RemoveAllFromFolder( “($Trash)” )
Print "Removed " & Count & " documents from " & db.Title & “'s Mailbox.”
End If
Set Db = Dbdir.GetNextDatabase
Wend
Obviously. it’s not working because I have removed all the docs from the collection when I call the “RemoveAllFrom Folder.”?!? Again, I think I have to set a new Collection object = to the docs in the Trash folder and then call “RemoveAll…” This is what’s stumping me!
As always, any help is much appreciated.