Out of office service activation with an run on server agent

倾然丶 夕夏残阳落幕 提交于 2019-12-23 21:56:55

问题


Is there an documentation or an easy solution how i can activate the out of office service in an user mailfile with an external run on server agent?

I tried it like this, but it does not work...

    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)

回答1:


UPDATE (changed answer from Out of office agent activation to Out of office service activation):

Look in MailFile ScriptLibrary OutOfOfficeLib in Class OutOfOfficeObj for method EnableService(). There is the code you have to adapt and put in your agent.

With the code line

Call db.SetOption( DBOPT_OUTOFOFFICEENABLED, True)

you activate the Out of Office service. There are some other settings you probably have to do in addition. Just follow the called methods in EnableService() and figure out what is really necessary.

Here is a good description how to activate and how to deal with issues with Out of Office service. Changes in users Out of Office service status e.g. might be visible only after sending the user an email.




回答2:


This is the way how it works.

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)


来源:https://stackoverflow.com/questions/17184283/out-of-office-service-activation-with-an-run-on-server-agent

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!