Hi there,
I wrote a script to remove all documents from a database, however when I view the database with notespeek, I still see a small number of documents remaining (1 to 10). The number remaining seems to vary from database to database. The documents are all mail messages, but when you open the db, it shows no documents in any of the folders.
The testers had developed an auto-hotkey script to delete the mail manually from the db, but they had discovered the same problem (documents remaining) which is why I wrote the script in the first place (hoping it would get everything). Any idea why these docs aren’t deleting?
here’s the heart of the script, which seems to run fine:
Set maildb = s.getdatabase(MailServer,"mail"&mailbox,0)
Set dc = maildb.AllDocuments
Print "Deleting " & Cstr(dc.Count) & " documents in database " & mailbox & “…”
Call dc.RemoveAll(True)
If dc.Count = 0 Then
Print “Success.”
Else
Print “Failed.”
End If
Thanks,
Scott
Subject: NotesDocumentCollection.RemoveAll Problem
The remaining documents have probably readers fields which makes them invisible to you.Try setting your agent runtime security level to “3: Allow restricted operations with full administration rights”, and make another agent which uses NotesAgent.RunOnServer to run your agent. Then it will find all documents in the database, because it uses the database on Local from the server perspective.
Subject: RE: NotesDocumentCollection.RemoveAll Problem
Thanks, Mika. I am already using agent.runonserver. I will make the changes to the security settings and see if that resolves it.
Subject: NotesDocumentCollection.RemoveAll Problem
The RemoveAll method is notoriously buggy. Try looking at this read for two other options:
http://www-10.lotus.com/ldd/nd6forum.nsf/DateAllThreadedweb/b0e363bbd0962d708525703d006eceb2?OpenDocument
Thanks,
MaryJane Johnson.
Subject: RE: NotesDocumentCollection.RemoveAll Problem
Notoriously buggy? If the user can’t read the documents, the user can’t delete the documents. That’s be a matter of, oh, let’s say proper security.
Subject: NotesDocumentCollection.RemoveAll Problem
The standard mail template uses several profile documents which are created as users work with Notes. I’m not sure if AllDocuments will include these or not since they may be user-specific and are treated a bit differently than regular documents.
Subject: RE: NotesDocumentCollection.RemoveAll Problem
I don’t believe they are because I used notespeek to look at them and they look like standard mail messages.
Thanks,
Scott
Subject: RE: NotesDocumentCollection.RemoveAll Problem
Have you inspected the item list in each for read-access flags?