Main Menu

Lotus Notes 6.5

Started by Mr. Analog, July 10, 2007, 10:44:00 AM

Previous topic - Next topic

Mr. Analog

I know some of you were/are Lotus-heads so I've got a question for you:

Idea:

  • A small .NET or Java based tray app that can set the "Out of Office" auto-reply feature in Lotus

Environment:

  • Lotus 6.5
  • User would be logged in with notes open, but has no admin privileges
  • Windows XP

Are there hooks or commands that can be sent to Lotus 6.5 to do this or would it have to be an update of the Lotus users database?
By Grabthar's Hammer

Darren Dirt

(go ahead and feign shock that I'm replying ;) )

IMHO you might be able to do this via the "Notes API" (usually it's via some DLLs, therefore you could call those functions via any other language like VB or ?.NET etc.) In a nutshell, you're gonna need to know the path to the database, and then open it up after authenticating (which would require connection to a user .ID file and knowing its password, methinks).

I've very rarely done stuff like this before, i.e. accessing a Notes database from outside Notes, but the few times I did I just looked online for "Lotus Notes API" and found a lot of good blogs and other resources that gave the names of the functions to call and their various parameters. Then I tested like crazy ;)

Good luck 8)
_____________________

Strive for progress. Not perfection.
_____________________

Darren Dirt

Ugh.

Might be more work than it's worth. :o


Here's the key piece of code from the typical mailfile's "(Out Of Office Profile)" form -- it's what runs when the "Enable/Disable" button is clicked.

I'm including it all, but in summary from what I can see it does a bunch of checks to validate permissions, etc. and then it "saves" the UIDoc -- which is the dialog form opened when you click "Tools -- Out of Office". That means to "manually" set the OOO to be enabled/disabled (ie. without referencing the dialog form) you would have to find the "Profile Document" in the database and know what field is turned on/off -- presuming it isn't "locked down" and only edit-able via the "Tools -- Out of Office" dialog form itself (via Readers/Authors fields).




(click: Edit Office Profile)
Const strWindowTitle = "Out of Office"
Sub Initialize
Dim session As notessession
Dim uiws As New notesuiworkspace
Dim m_officeprofile As notesdocument
Dim nSuccess As Integer

Set session = New notessession
Set m_officeprofile = session.CurrentDatabase.GetProfileDocument("OutOfOfficeProfile")

Call m_officeprofile.ReplaceItemValue("SaveOptions","0") 'default to allow cancel/exit of form without "save?" auto-prompt

nSuccess = uiws.dialogbox("OutOfOfficeProfile",True,True,True,False,False,False,strWindowTitle,m_officeprofile,True,True) 'open dialog
End Sub

(main code that is referenced from within the "OutofOfficeProfile" dialog form)

Class OutOfOfficeControl As BaseApplication
...
'this is launched via the Enable/Disable button
Public Function ToggleEnableDisable()
If ToggleEnableDisableEx() Then 'see below...
Call Me.m_noteUIDoc.reload()
Call Me.m_noteUIDoc.Refreshhideformulas()
Call Me.m_noteUIDoc.Save
End If
End Function


'called from above...
Private Function ToggleEnableDisableEx() As Integer

ToggleEnableDisableEx = True
Me.m_ProcessAdminRequest = False
On Error Goto TRAP

If Me.m_agentOutOfOffice.IsEnabled Then

'// user has submited multiple requests for AdminP - Need to warn
If  (Me.m_noteUIDoc.document.GetItemValue("AdminP_Counter")(0) > "0") Then
Me.m_nResult = Messagebox(Me.m_MailStringTable.GetString(TOOL_STRING + 21,Null) & Chr(13) & _
Me.m_MailStringTable.GetString(TOOL_STRING + 22,Null),MB_YESNO,Me.m_MailStringTable.GetString(TOOL_STRING + 17,Null))
If Me.m_nResult = IDNO Then
'ToggleEnableDisableEx = False
Call Me.m_noteUIDoc.reload()
Call Me.m_noteUIDoc.Refreshhideformulas()
Exit Function
End If
End If

'// User is requesting to Disable the Agent
Me.m_nResult = Messagebox(Me.m_MailStringTable.GetString(TOOL_STRING + 47,Null) & Chr(13) & _
Me.m_MailStringTable.GetString(TOOL_STRING + 48,Null),MB_YESNO,Me.m_MailStringTable.GetString(TOOL_STRING + 46,Null))

If Me.m_nResult = IDYES Then

'//flags
Me.m_vAgentActivate = False
Me.m_vAgentEnable = False
'//check user's ACL

'//user is author or less - we don't allow
If Me.m_dbCurrentDatabase.Currentaccesslevel < 4 Then
Me.m_nUserHasRestrictedAccess = True
Messagebox Me.m_MailStringTable.GetString(TOOL_STRING+45,Null), MB_OK,_
Me.m_MailStringTable.GetString(TOOL_STRING+17,Null)
Exit Function

'//user is Editor
Elseif Me.m_dbCurrentDatabase.Currentaccesslevel = 4 Then
If Not (Me.m_OnbehalfOf = Me.m_dbOwner) Or Not (Me.m_vAlowActivation) Then
'//Call AdminP to Activate "allow user activation" flag and Disable Agent
Me.m_vAgentActivate = True
Me.m_ProcessAdminRequest = True
Call CreateAdminPAuthentication( Me.m_vAgentActivate, Me.m_vAgentEnable )
Else '// user has rights to disable agent
Call GetHomeServer()
Me.m_ProcessAdminRequest = False
Me.m_agentOutOfOffice.IsEnabled = False
Call Me.m_agentOutOfOffice.save
End If

'//user is Designer or above
Elseif Me.m_dbCurrentDatabase.Currentaccesslevel > 4 Then
If ( m_vAlowActivation ) Then
'//Call AdminP to Deactivate "allow user activation" flag and Disable Agent
Me.m_ProcessAdminRequest = True
Call CreateAdminPAuthentication( Me.m_vAgentActivate, Me.m_vAgentEnable )
Else '// user has rights to disable agent
Call GetHomeServer()
Me.m_ProcessAdminRequest = False
Me.m_agentOutOfOffice.IsEnabled = False
Call Me.m_agentOutOfOffice.save
End If
End If

'// User requested AdminP to disable the agent - Waiting state.
If  (Me.m_agentOutOfOffice.IsEnabled) And (m_ProcessAdminRequest) Then
Call Me.m_noteUIDoc.document.replaceitemvalue("CurrentStatus","1")
Call Me.m_noteUIDoc.document.replaceitemvalue("AdminP_Status","DISABLE") 'AdminP request to disable
Call Me.m_noteUIDoc.document.replaceitemvalue("SaveOptions","1")
Call Me.m_noteUIDoc.document.ReplaceItemValue ("Notified", "")
If Me.m_noteUIDoc.document.HasItem("DateFirstReminderSent") Then '//Clean up for First reminder
Call Me.m_noteUIDoc.document.RemoveItem ("DateFirstReminderSent")
End If
Call Me.m_noteUIDoc.document.save(True,True,True)
Goto SetBusyTime

'// User with no rights to disable agent
Elseif Me.m_agentOutOfOffice.IsEnabled Then
Call Me.m_noteUIDoc.document.save(True,True,True)
Me.m_nResult = Messagebox(Me.m_MailStringTable.GetString(TOOL_STRING + 44,Null) _
& Chr(13) & Me.m_MailStringTable.GetString(TOOL_STRING + 45,Null), _
MB_OK,Me.m_MailStringTable.GetString(TOOL_STRING + 46,Null))

'// Agent is disable
Else
Call Me.m_noteUIDoc.document.replaceitemvalue("CurrentStatus","0")
Call Me.m_noteUIDoc.document.replaceitemvalue("AdminP_Status","")
Call Me.m_noteUIDoc.document.ReplaceItemValue ("Notified", "")
If Me.m_noteUIDoc.document.HasItem("DateFirstReminderSent")Then '//Clean up for First reminder
Call Me.m_noteUIDoc.document.RemoveItem ("DateFirstReminderSent")
End If
Call Me.m_noteUIDoc.document.replaceitemvalue("SaveOptions","1")
Call Me.m_noteUIDoc.document.save(True,True,True)
Me.m_nResult = Messagebox(Me.m_MailStringTable.GetString(TOOL_STRING + 49,Null), _
MB_OK,Me.m_MailStringTable.GetString(TOOL_STRING + 46,Null))
SetBusyTime:
If Me.m_noteUIDoc.document.BookBusyTime(0) = "1" Then
If Me.m_noteUIDoc.document.GetItemValue("OwnerOfCalendarEntry")(0) = "1" Then
'call look for calendar entry and ask if I should disable busy time only if date is less than return date?
If Me.m_dtFirstDayBack.Timedifferencedouble(Me.m_dtNow)  > 0 Then
Me.m_nSuccess = Messagebox( Me.m_MailStringTable.GetString(TOOL_STRING + 66,Null), MB_YESNO, Me.m_MailStringTable.GetString(TOOL_STRING + 46,Null))
If Me.m_nSuccess = IDYES Then
Set Me.m_noteCalendarEntry = Me.m_dbCurrentDatabase.GetDocumentByUNID(Me.m_noteUIDoc.document.GetItemValue("CalendarEntryUNID")(0))
If Not Me.m_noteCalendarEntry Is Nothing Then
With Me.m_noteCalendarEntry
Call .ReplaceItemValue("$BusyPriority","2")
Call .ReplaceItemValue("BookFreeTime", "1")
Call .Save(True,True,True)
End With
Call Me.m_noteUIDoc.document.replaceitemvalue("OwnerOfCalendarEntry","0")
Call Me.m_noteUIDoc.document.replaceitemvalue("CalendarEntryUNID", "")
Else
Call DisplayWarn(Me.m_MailStringTable.GetString(TOOL_STRING + 67,Null), MB_OK,_
Me.m_MailStringTable.GetString(TOOL_STRING + 46,Null))
End If
End If
End If
End If
End If
End If
End If
Call m_noteuidoc.refreshhideformulas
Call m_noteuidoc.reload
Exit Function
Else '// User is requesting to Enable the Agent

'// user has submited multiple requests for AdminP - Need to warn
If  (Me.m_noteUIDoc.document.GetItemValue("AdminP_Counter")(0) > "0") Then
Me.m_nResult = Messagebox(Me.m_MailStringTable.GetString(TOOL_STRING + 20,Null) & Chr(13) & _
Me.m_MailStringTable.GetString(TOOL_STRING + 22,Null),MB_YESNO,Me.m_MailStringTable.GetString(TOOL_STRING + 17,Null))
If Me.m_nResult = IDNO Then
Call Me.m_noteUIDoc.reload()
Call Me.m_noteUIDoc.Refreshhideformulas()
Exit Function
End If
End If

If ValidateSettings() Then
Me.m_vAgentActivate = True
Me.m_vAgentEnable = True
'//need to get user's server name
Call GetHomeServer()
'//Get user's disposition
Me.m_nResult = Messagebox(Me.m_MailStringTable.GetString(TOOL_STRING + 87,Null)  & _
Me.m_namHomeServer.Abbreviated & Chr(13) & Me.m_MailStringTable.GetString(TOOL_STRING + 54,Null) & _
Me.m_noteUIDoc.FieldGetText("FirstDayOut") & Me.m_MailStringTable.GetString(TOOL_STRING + 55,Me.m_noteUIDoc.FieldGetText("FirstDayBack")) &_
Chr(13) & Me.m_MailStringTable.GetString(TOOL_STRING + 23,Null),MB_YESNO, _
Me.m_MailStringTable.GetString(TOOL_STRING + 46,Null))
If Me.m_nResult = IDNO Then
Call Me.m_noteUIDoc.reload()
Call Me.m_noteUIDoc.Refreshhideformulas()
Exit Function
End If

'//check user's ACL
If Me.m_dbCurrentDatabase.Currentaccesslevel < 4 Then
'//user is author or less - we don't allow
Me.m_nUserHasRestrictedAccess = True
Messagebox Me.m_MailStringTable.GetString(TOOL_STRING+50,Null), MB_OK,_
Me.m_MailStringTable.GetString(TOOL_STRING+17,Null)
Exit Function

'//user is Editor
Elseif Me.m_dbCurrentDatabase.Currentaccesslevel = 4 Then
If Not (Me.m_OnBehalfOf = Me.m_dbOwner) Or Not (Me.m_vAlowActivation) Then
'// calling AdminP to Activate and Enable agent
Me.m_ProcessAdminRequest = True
Call CreateAdminPAuthentication( Me.m_vAgentActivate, Me.m_vAgentEnable )
Else
'// user enabling Agent
Me.m_ProcessAdminRequest = False
Call GetHomeServer()
Me.m_agentOutOfOffice.IsEnabled = True
Call m_agentOutOfOffice.save
End If

'//user is Designer or above
Elseif Me.m_dbCurrentDatabase.Currentaccesslevel > 4 Then
If  ( m_vAlowActivation ) Then
'// calling AdminP to Deactivate agent's flag "allow user activation"
Me.m_ProcessAdminRequest = True
Me.m_vAgentActivate = False
Call CreateAdminPAuthentication( Me.m_vAgentActivate, Me.m_vAgentEnable )
Else
'// user enabling Agent
Me.m_ProcessAdminRequest = False
Call GetHomeServer()
Me.m_agentOutOfOffice.ServerName = Cstr(Me.m_vHomeServer(0))
Me.m_agentOutOfOffice.IsEnabled = True
Call m_agentOutOfOffice.save
End If
End If

If Me.m_agentOutOfOffice.IsEnabled Then
Call BookBusyTime()
Call Me.m_noteUIDoc.document.removeitem("AgentLastRun")
Call Me.m_noteUIDoc.document.replaceitemvalue("CurrentStatus","1")
Call Me.m_noteUIDoc.document.replaceitemvalue("AdminP_Status","")
Call Me.m_noteUIDoc.document.replaceitemvalue("SaveOptions","1")
Call Me.m_noteUIDoc.document.ReplaceItemValue ("Notified", "")
If Me.m_noteUIDoc.document.HasItem("DateFirstReminderSent") Then '//Clean up for First reminder
Call Me.m_noteUIDoc.document.RemoveItem ("DateFirstReminderSent")
End If
Call Me.m_noteUIDoc.document.save(True,True,True)
Me.m_nResult = Messagebox(Me.m_MailStringTable.GetString(TOOL_STRING + 53,Null)  & _
Me.m_namHomeServer.Abbreviated & Chr(13) & Me.m_MailStringTable.GetString(TOOL_STRING + 54,Null) & _
Me.m_noteUIDoc.FieldGetText("FirstDayOut") & Me.m_MailStringTable.GetString(TOOL_STRING + 55,Me.m_noteUIDoc.FieldGetText("FirstDayBack")),MB_OK, _
Me.m_MailStringTable.GetString(TOOL_STRING + 46,Null))

'// User requested AdminP to enable the agent - Waiting state.
Elseif Not (Me.m_agentOutOfOffice.IsEnabled) And (m_ProcessAdminRequest) Then
Call Me.m_noteUIDoc.document.replaceitemvalue("CurrentStatus","0") '// Agent still Disable
Call Me.m_noteUIDoc.document.replaceitemvalue("AdminP_Status","ENABLE") '// Request submitted
Call Me.m_noteUIDoc.document.replaceitemvalue("SaveOptions","1")
Call Me.m_noteUIDoc.document.ReplaceItemValue ("Notified", "")
If Me.m_noteUIDoc.document.HasItem("DateFirstReminderSent") Then '//Clean up for First reminder
Call Me.m_noteUIDoc.document.RemoveItem ("DateFirstReminderSent")
End If
Call Me.m_noteUIDoc.document.save(True,True,True)
'Me.m_nResult = Messagebox(Me.m_MailStringTable.GetString(TOOL_STRING + 87,Null)  & _
'Me.m_namHomeServer.Abbreviated & Chr(13) & Me.m_MailStringTable.GetString(TOOL_STRING + 54,Null) & _
'Me.m_noteUIDoc.FieldGetText("FirstDayOut") & Me.m_MailStringTable.GetString(TOOL_STRING + 55,Me.m_noteUIDoc.FieldGetText("FirstDayBack")),MB_OK, _
'Me.m_MailStringTable.GetString(TOOL_STRING + 46,Null))
Else
Me.m_nResult = Messagebox(Me.m_MailStringTable.GetString(TOOL_STRING + 56,Null) & Chr(13) & _
Me.m_MailStringTable.GetString(TOOL_STRING + 50,Null) ,MB_OK,Me.m_MailStringTable.GetString(TOOL_STRING + 46,Null))
End If
Else
ToggleEnableDisableEx = False
End If
End If
Call m_noteuidoc.refreshhideformulas
Call m_noteuidoc.reload
Exit Function

Trap:
If Err = 4091 Then
Resume Next
Else
Print("Notes error: " & Cstr(Err) & " " &  Error$)
Resume Next
End If
End Function




See what I mean by "ugh"? :(

_____________________

Strive for progress. Not perfection.
_____________________

Mr. Analog

Thanks man, this may become part of our toolbox of widgets we are continually developing to make life in the office easier. One of the great challenges is having people remember to set their out of office auto-reply, we do it so infrequently that many long time users do not even know where the feature is in Lotus. Rather than continue trying to enforce the "dumb" way, we think it would be easier to provide a one or two click toggle on a pre-existing tray application to make it an easy to use / highly visible process.

Thanks DD!
By Grabthar's Hammer

Darren Dirt

Hey I just thot of something simple... or simply stupid.

You know how as an adminstrator you sometimes use "automation" tools to fake mouse moves/clicks and keypresses (e.g. when installing a client station with MSSQLServer tools or Peoplesoft or whatnot) -- Melbosa remembers what I'm talking about.

Why not use one of THOSE tools to switch to the "notes.exe" process, set focus, go to the inbox view, "click" Tools -- Out Of Office, then click "Enable" and "OK"?

The only problem I can see with this is identifying whether or not the button says "Enable" or "Disable"... but then again I don't think I fully understand what the scenario is where this widget/gadget would be used ;)
_____________________

Strive for progress. Not perfection.
_____________________