Wednesday, January 02, 2008

how to take all schedule agents from db

it takes all schedule agents from database. I suppose that somebody will find better solution, but for this moment I don't see the better solutions...

Dim s As New NotesSession
Dim db As NotesDatabase
Dim nc As NotesNoteCollection

Set db = s.CurrentDatabase

Set nc = db.CreateNoteCollection(False)
nc.SelectAgents = True
Call nc.BuildCollection

Dim note As NotesDocument
Dim nid As String
Dim flag As String

nid = nc.GetFirstNoteId
For i = 1 To nc.Count

Set note = db.GetDocumentByID(nid)
flag = note.GetItemValue("$Flags")(0)

If Instr(flag, "S") Then
Print note.GetItemValue("$Title")(0)
End If
nid = nc.GetNextNoteId(nid)
Next

3 comments :

Anonymous said...

Great work.

Gunasekaran said...

This is really a good information. Is there any way to differentiate the script library?

Dmytro said...

Yes, take a look on this class notesNoteCollection
http://publib.boulder.ibm.com/infocenter/domhelp/v8r0/index.jsp?topic=%2Fcom.ibm.designer.domino.main.doc%2FH_NOTESNOTECOLLECTION_CLASS.html

example:
notesNoteCollection.SelectScriptLibraries = flag