Doc.remove does not always work

I have an agent which contains Lotusscrip to loop through a set of docs and delete them using doc.remove.

I get different results every time I run the agent. Sometimes I get an error on one doc that I am not authorized to do this and sometimes the docs gets deleted.

Subject: doc.remove does not always work

When I read your posting, I thought… Sounds right to me?

Do you have the rights to delete ANY document? (Are you Editor or higher? Do you have Delete Document?)

What if someone is working with the document, in the front end, when you try and delete it?

Do you have Call doc.Remove(True)

Subject: RE: doc.remove does not always work

Yes I am using Call doc.Remove(True) and I have full manager access including delete option.

I have also tried running the agent as a server with full access with no luck.

Is there anyway I can do a check before I attempt to do the doc.remove so that I can skip over that doc?

Subject: doc.remove does not always work

Use parameter force=true of remove method…i guess it should work

Subject: I know the problem - whats solution

I think I have ascertained what the problem is. The code is as follows:

Set acl = mailindb.ACL

Set entry = acl.GetEntry( “myName” )

If Not entry.CanDeleteDocuments Then

entry.CanDeleteDocuments = True

Call acl.Save

End If

Set draftsdoc = mailindb.GetDocumentByID(matchnoteid(x))

Call draftsdoc.Remove(True)

The problem is that ‘call acl.save’ does not take effect until the db is closed and LS has stopped running.Becuse the first part of the script has not taken effect, the doc.remove is not working.

How can I force the acl.save to actually save before I get to draftsdoc.Remove stage?

Subject: RE: I know the problem - whats solution

Oh, man, the information people leave out when they post a question here!

ACL is cached, yes, and changes will generally not take effect until you exit the application. I could pursue this line and try to help you get it working, but it’s wrong to be making ACL changes just so you can run one agent. I assume that’s what you’re doing? You don’t ordinarily want access to delete documents, to avoid deleting them accidentally, so you turn it on during this one agent, then turn it off again?

Couldn’t you just enable soft deletions instead, and leave yourself delete access full time?

Subject: RE: I know the problem - whats solution

Sorry I posted the infor that I knew at the time.

We have a organisational policy that Lotus Notes admins do not have delete access automatically. So any housekeeping tasks we have to do like this, we have to write agents.

Your help is appreciated.