Hello everybody,I need to develop an agent that will delete some documents from the DB.
In my profiling documents, i have two fields, one is the id of the current document, and the other field is the id of another document.
my agent must delete the document whose id is the second field.
any ideas?
thanx a lot
Subject: Agent to delete specific documents
dim session as new notessessiondim db as notesdatabase
dim prfdoc as notesdocument
dim doc as notesdocument
dim sUnid as string
set db = session.currendatabase
set prfdoc = db.getprofiledocument(“name”, “key”)
sUnid = prfdoc.FieldTwo(0)
set doc = db.getdocumentbyUNID(sUnid)
if not(doc is nothing) then
doc.remove(true)
else
print “doc not found”
end if
set doc = nothing
…
It will need some adjustments but you can use this as a base.
Best regards,
http://www.windelen.be
Subject: RE: Agent to delete specific documents
But in this script, i will not run all the documents in a view?
Subject: RE: Agent to delete specific documents
Don’t know what you mean exactly, but if you have the id of a document you don’t have to run through a whole view.
If you mean more profile documents, well there isn’t a view with all the profile documents but you can use getprofiledoccollection instead of getprofiledocument. Which will give you all profile documents wich you have to iterate to get all the values from them.