Notes Ninjas Notes Ninjas
Lotus Notes hints, tips, error messages
Add certain docs to folder depending on date

Hint Short Cut: Add this to your code & documentation to help you find this page.
http://www.notesninjas.com/#ArchiveToFolder or http://www.notesninjas.com/A555F9/nn.nsf/ByAlias/ArchiveToFolder

This is a bit of code that moves documents rejected before a certain date into a folder.


Put this into a button:

Dim s As New notessession
Dim db As notesdatabase

Set db = s.currentdatabase

defdate = s.getenvironmentstring("eDefDate")
deffolder = s.getenvironmentstring("eDefFolder")

If defdate="" Then defdate = Cstr(Today)
If deffolder="" Then deffolder = "RejectedAgesAgo"


d= Inputbox$("What date should they be created before?", "Date", defdate)
f=Inputbox$("What folder should they be put in?","Folder", deffolder)

Call s.setenvironmentvar("EDefDate", d)
Call s.setenvironmentvar("EDefFolder", f)

Dim col As notesdocumentcollection
Set col = db.ftsearch("",20)

Set SearchDate = New NotesDateTime("01/10/1999")

Selection = "Form = ""F1"" & Date1 <= @Adjust(" & d & ";0;0;0;0;0;0)"
Selection = "Form = ""F1"" & Date1 <= [" & d & "]"
Print Selection

Set Col = DB.Search(Selection, SearchDate, 0)
If Col.Count = 0 Then
Print "none found"
Else
Call col.putallinfolder(f)
Print "moved " & col.count
End If

Note a new folder is not shown on the folders view until the database is closed

and reopened. If you know a way aroud this let me know! 

 Jump to:     Notes Tips
    Lotus Notes Index 
  Register for Tips
Previous Lotus Notes Tip 
    Next Lotus Notes Tip
Your company logo here?
Adam Foster
Free Cash Making Web Site
Free Revenue Earning Blog Site
 Free Revenue Earning Newsletter Site   
Free Search Pages Free Web stats
Free Contact Us page
Cheap .com domain names
 Need a website or 
   Lotus Notes
  problem solved?
Adam Foster
Web Services Platform Architecture: Soap, WSDL, WS-Policy, WS-Addressing, WS-Bpel, WS-Reliable Messaging and More by Francisco Curbera, Frank Leymann, Tony Storey, Donald Ferguson, Sanjiva Weerawarana
Other books claim to present the complete Web services platform architecture, but this is the first one I've seen that really does. The authors have been intimately involved in the creation of the architecture. Who better to write this book?
See at: Amazon.co.uk | Amazon.com |