Domino Code Fragment

Code Name*
unprocessedSearch method
Date*
04/28/2024
Source (or email address if you prefer)*
Rlatulippe@romac.com
IP address:.3.149.233.72
Description*
This example searches all or selected documents for documents created after January 1, 1997 that contain "botany" in the Subject field, and places them in the "Botanist's Delight" folder.
Type*
Java
Categories*
(Misc)
Implementation:
Required Client:
Server:
Limitations:
Comments:
Files/Graphics attachments (if applicable): Code:
import java.util.*;
import lotus.notes.*;


public class unprocessedsearchagent extends AgentBase
{
 public void NotesMain()
   {
   try
     {
       Session s = getSession();
       AgentContext ac = s.getAgentContext();
       DateTime date = s.createDateTime("01/01/97");
       DocumentCollection dc = ac.unprocessedSearch
       ("@Contains(Subject; \"botany\")", date, 0);
       Document doc;
       int size = dc.getCount();
       for (int i = 1; i <= size; i++)
       {
         doc = dc.getNthDocument(i);
         doc.putInFolder("Botanist's Delight");
         ac.updateProcessedDoc(doc);
         System.out.println
         (i + " *** " + doc.getItemValue("Subject"));
       }
     }
   catch (Exception e)
     {
       e.printStackTrace();
     }
   }
}