使用服务器代理上的运行激活不在办公室服务

时间:2013-06-19 06:28:49

标签: lotus-notes lotusscript

是否有文档或简单的解决方案如何在服务器代理上使用外部运行来激活用户邮件文件中的外出服务?

我试过这样,但它不起作用......

    Dim s As New NotesSession
    Dim db As NotesDatabase
    Dim doc As NotesDocument
    Dim dt As New NotesDateTime(Now)

    Set db = s.Getdatabase("SERVERNAME", "MAILFILE")

    Set doc = db.Createdocument()

    doc.AppointmentType= "2"
    doc.BookFreeTime = ""
    doc.CreatedByAgent = "1"
    doc.ExcludeFromView = "D"
    doc.Form = "Appointment"
    doc.From = s.Username
    doc.Principal = s.Username
    Call doc.Replaceitemvalue("$BusyName","")
    Call doc.Replaceitemvalue("$BusyPriority","")
    Call doc.Replaceitemvalue("$PublicAccess","1")
    doc.ApptUNID = doc.Universalid

    Call dt.Adjustday(-5)
    set doc.EndDate = dt
    set doc.EndDateTime = dt
    call dt.Adjustday(10)
    set doc.StartDate = dt
    set doc.STARTDATETIME = dt
    doc.Subject = "Out Of Office"
    Call doc.Replaceitemvalue("$UpdatedBy",s.Username)
    Call doc.save(True,False)


    Set doc = db.Getprofiledocument("OutOfOfficeProfile")
    Call dt.Adjustday(-5)
    Set doc.FirstDayOut = dt
    Call dt.Adjustday(10)
    Set doc.FirstDayBack = dt
    doc.CurrentStatus = "1"
    doc.GeneralSubject = "HE IS NOT AVAILABLE"

    Call doc.save(True,false)

2 个答案:

答案 0 :(得分:1)

更新(从办公室外代理激活到外出服务激活的更改答案):

查看类OutOfOfficeLib中的MailFile ScriptLibrary OutOfOfficeObj以查找方法EnableService()。您需要调整代码并将其放入代理中。

使用代码行

Call db.SetOption( DBOPT_OUTOFOFFICEENABLED, True)

激活外出服务。此外,您可能还需要执行其他一些设置。只需按照EnableService()中的被调用方法,找出真正需要的方法。

以下是如何激活以及如何处理Out of Office service问题的详细说明。用户更改服务外出服务状态,例如只有在向用户发送电子邮件后才可见。

答案 1 :(得分:1)

这就是它的工作方式。

Dim db As NotesDatabase
    Dim doc As NotesDocument
    Dim dt As New NotesDateTime(Now)

    Set db = s.Getdatabase("SERVER", "MAILFILE")    

    Set doc = db.Getprofiledocument("OutOfOfficeProfile")
    Call dt.Adjustday(-5)
    Set doc.FirstDayOut = dt
    Set doc.StartTime = dt
    Call dt.Adjustday(10)
    Set doc.FirstDayBack = dt
    Set doc.EndTime = dt
    doc.CurrentStatus = "1"
    doc.GeneralSubject = "MESSAGE"

    doc.TaskState = "1"
    doc.CurrentSate = "1"
    doc.ShowHours = ""

    Call doc.Computewithform(false, false)

    Call doc.save(True,false)

    Call db.SetOption( DBOPT_OUTOFOFFICEENABLED, True)