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

while (Inputgracedays > Maxdays)
Msgbox ("Maximum of" & Maxdays
& "Days exceeded")
Goto GetInput
Wend

If inputgracedays <>-1 Then
Gracedays = Inputgracedays
End If

Set Gracedoc = db. Getprofiledocument ("Inboxgracedays")
Gracedoc. Replaceitemvalue "Gracedays", gracedays
Call Gracedoc. Save (False,false)
End Sub

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.