Clearing the agent for the Inbox code for Cleanupinbox Agent
Source: Internet
Author: User
Cleanupinbox–moves older documents out of inbox
Sub Initialize
Dim s as New notessession
Dim DB as NotesDatabase
Set db = S.currentdatabase
Dim DR1 as Notesdaterange
Dim V as Notesview
Dim DC1 as Notesdocumentcollection
Dim Gracedoc as NotesDocument
Dim stime1 as New notesdatetime ("0/0/0")
Dim etime1 as New notesdatetime ("Today")
Set Gracedoc = db. Getprofiledocument ("Inboxgracedays")
Dim Graceval as Variant
Dim Gracedays as Integer
' If no profile doc have been prepared, default is
If Gracedoc. Hasitem ("Gracedays") Then
Graceval = Gracedoc. GetItemValue ("Gracedays")
Gracedays = Cint (graceval (0))
Else
Gracedays = 90
End If
Etime1. Adjustday ( -1*gracedays)
' Create a daterange excluding docs newer than graceperiod
Set DR1 = S.createdaterange ()
Set DR1. StartDateTime = stime1
Set DR1. EndDateTime = etime1
' Dc1:collection of ' old ' documents from inbox
(before or on today-gracedays)
Set v = db. GetView ("($Inbox)")
Set DC1 = V.getalldocumentsbykey (DR1)
' Pull out expired docs
DC1. Removeallfromfolder ("($Inbox)")
End Sub
' Setinboxgraceperiod agent–sets the grace period for inbox
Sub Initialize
Dim s as New notessession
Dim DB as NotesDatabase
Set db = S.currentdatabase
Dim Gracedoc as NotesDocument
Dim Gracedays as Integer
Dim Inputgracedays as Integer
Dim Maxdays as Integer
Dim Graceval as Variant
Dim Gracevar as Variant
Maxdays = 1000
Set Gracedoc = db. Getprofiledocument ("Inboxgracedays")
If Gracedoc. Hasitem ("Gracedays") Then
Graceval = Gracedoc. GetItemValue ("Gracedays")
Gracedays = Cint (graceval (0))
Else
Gracedays = 90
End If
GetInput:
Inputgracedays =-1
Gracevar = Inputbox ("Days to retain in Inbox?") (Currently "&
Gracedays & ")")
If (Gracevar <> ") Then
Inputgracedays = Cint (Gracevar)
End If
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.