zoukankan      html  css  js  c++  java
  • 清理收件夹的代理Code for CleanupInbox agent

     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 has been prepared, default is 90 days
    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

  • 相关阅读:
    1 < 2 < 3为true, 3 > 2 > 1为false
    我的第五代选择器Icarus
    浮动不换行
    教你游泳,不会游的看了包你学会!!! 分享
    node.js 一个简单的页面输出
    天将降大任于斯人也,必先苦其心志,劳其筋骨,饿其体肤,空乏其身,行拂乱其所为,所以动心忍性,增益其所不能
    setTimeout和setInterval的使用
    JS window.open()属性
    车牌识别及验证码识别的一般思路
    苹果开发者账号注册流程
  • 原文地址:https://www.cnblogs.com/hannover/p/1964515.html
Copyright © 2011-2022 走看看