Examples: UnprocessedSearch method
- This agent script allows a user to perform a search on selected
documents. UnprocessedSearch returns the documents currently selected
that were created after May 20, 1995 and that contain "botany" in
the Subject item, and places them into a folder.
Sub Initialize Dim session As New NotesSession Dim db As NotesDatabase Dim dateTime As NotesDateTime Dim collection As NotesDocumentCollection Dim doc As NotesDocument Set db = session.CurrentDatabase Set dateTime = New NotesDateTime( "05/20/95" ) Set collection = db.UnprocessedSearch _ ( "@Contains( Subject; ""botany"" )", dateTime, 0 ) Set doc = collection.GetFirstDocument() While Not(doc Is Nothing) Call doc.PutInFolder( "Botanist's Delight" ) Set doc = collection.GetNextDocument(doc) Wend End Sub
- This agent script runs on all newly created and modified documents
that were created after May 20, 1995 and that contain "botany" in
the Subject item. The purpose of the script is to modify the Status
item of each document it processes.
- If the agent does not contain any searches defined in the Agent Properties box and runs for the first time on October 17, 1995, UnprocessedSearch returns all the documents in the database that were created after May 20, 1995 and that contain "botany" in the Subject item. The script puts "Processed by agent on 10/17/95" into the Status item of each returned document, saves the document, and marks it as processed. If the agent runs again the next day, and five documents have been created or modified since the 17th, UnprocessedSearch searches only those five documents -- all other documents have been marked as processed -- and returns those that were created after May 20, 1995 and that contain "botany" in the Subject item. The script puts "Processed by agent on 10/18/95" into the Status item of each returned document. If the agent runs again the next day, and one document has been created since the 18th, UnprocessedSearch returns the document only if it was created after May 20, 1995 and contains "botany" in the Subject item; otherwise, it returns a NotesDocumentCollection with zero documents.
- If the agent does contain searches defined in the Agent Properties
box and runs for the first time on October 17, 1995, UnprocessedSearch
returns all the documents in the database that meet the search criteria
defined in the Agent Properties box, were created after May 20, 1995, and that
contain "botany" in the Subject item. If the agent runs again the
next day, and five documents have been created or modified since the
17th, but only two of them meet the search criteria defined in the
Agent Properties box, were created after May 20, 1995, and contain
the word "botany", UnprocessedSearch returns those two documents.
If the agent runs again the next day, and one document has been created
since the 18th but does not meet the search criteria defined in the
Agent Properties box, or was created before May 20, 1995, or does
not contain "botany" in the Subject item, UnprocessedSearch returns
an empty NotesDocumentCollection.
Sub Initialize Dim session As New NotesSession Dim db As NotesDatabase Dim dateTime As NotesDateTime Dim collection As NotesDocumentCollection Dim todayDateTime As NotesDateTime Dim doc As NotesDocument Set db = session.CurrentDatabase Set dateTime = New NotesDateTime( "05/20/95" ) Set collection = db.UnprocessedSearch _ ( "@Contains( Subject; ""Botany"" )", dateTime, 0 ) Set doc = collection.GetFirstDocument() Set todayDateTime = New NotesDateTime( "Today" ) While Not(doc Is Nothing) doc.Status = "Processed by agent on " & _ todayDateTime.LocalTime Call doc.Save( True, True ) Call session.UpdateProcessedDoc( doc ) Set doc = collection.GetNextDocument(doc) Wend End Sub
- This agent script runs on all unread documents that were created
after January 20, 1996 and that contain "URGENT" in the Subject item.
The purpose of the script is to put these documents into a folder.
- If the agent does not contain a search defined in the Agent Properties box, UnprocessedSearch returns all unread documents in the database that were created after January 20, 1996 and that contain "URGENT" in the Subject item, regardless of whether the agent has already run on some of the unread documents at an earlier time.
- If the agent does contain searches defined in the Agent Properties
box, UnprocessedSearch returns all unread documents in the database
that meet the search criteria defined in the Agent Properties box,
were created after January 20, 1996, and that contain the word "URGENT",
regardless of whether the agent has already run on some of the unread
documents at an earlier time.
Sub Initialize Dim session As New NotesSession Dim db As NotesDatabase Dim dateTime As NotesDateTime Dim collection As NotesDocumentCollection Dim doc As NotesDocument Set db = session.CurrentDatabase Set dateTime = New NotesDateTime( "01/20/96" ) Set collection = db.UnprocessedSearch _ ( "@Contains( Subject; ""URGENT"" )", dateTime, 0 ) Set doc = collection.GetFirstDocument() While Not(doc Is Nothing) Call doc.PutInFolder _ ( "Stop dreaming! Read these documents!" ) Set doc = collection.GetNextDocument(doc) Wend End Sub