Remove docs from ($Trash) folder?

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.

Subject: Remove docs from ($Trash) folder?

since you don’t want to allow the docs to follow the soft deletions rule you will have to go about this a different way. Something like this will take a bit more time to process but given your requirement I believe it is the only way

Dim doc as NotesDocument

For i = 1 to docColl.Count

Set doc = docColl.GetNthDocument(i)

If doc.IsValid Then

Call doc.RemovePermanently(True)

End if

Next

Subject: Thanks, Paul…

I thought I might have to delete them individually. I appreciate all your time and help!