Solved

Lotus Notes Calendar Programming from Visual Basic

Posted on 2007-03-21
1
1,405 Views
Last Modified: 2013-11-17
We have a VB application that allows a user to schedule a call back to a client.  The user provides call back adte and time, subject line, and add'l notes (to be contained in the body of a 'reminder' calendar entry).The VB code creates an instance of a Lotus Notes workspace and adds a 'reminder' for the user to call back the client. The problem we are experiencing is that we cannot get the add'l notes to add to the 'Body' property of the 'reminder' entry.  When reviewing the property via Notes, the 'Body' feld is set to SEAL. So, I suspect this is causing the issue.  Can anyone assist with updating/setting this flag programmatically so the "body' of the 'reminder' will contain the add'l notes?  Time is of the essence!  

I've included code below.  Thanks for your help.

Private Function ScheduleCallBack() As Boolean

    'error handler
    On Error GoTo ErrHandler
   
    'local declares
    Dim oCalenDoc   As Object   'calendar entry
    Dim oWorkSpace  As Object   'notes workspace
    Dim iLoop       As Integer  'loop counter
    Dim sBody       As String   'body of reminder
    Dim sSTime      As String   'start time
    Dim sSubject    As String   'subject line
   
    '-----------------------------------------------
    ' date and time validation
    '-----------------------------------------------
    'exit if no time selected
    If cboTime.ListIndex = -1 Then
        MsgBox "Please select a time for call back.", vbExclamation, "Error"
        ScheduleCallBack = False
        Exit Function
    End If
   
    'exit if call back date/time have passed
    If CDate(txtDate & " " & cboTime) < (gvDate & " " & Time) Then
        If MsgBox("Scheduled Call Back is in the past. Schedule anyway?", vbQuestion + vbYesNo, "Confirm Request") = vbNo Then
            ScheduleCallBack = False
            Exit Function
        End If
    End If
   
    '-----------------------------------------------
    ' initial tasks
    '-----------------------------------------------
    Screen.MousePointer = vbArrowHourglass
    iLoop = 0
    sBody = Trim(txtNotes)
    sSubject = "Call Back: " & Trim(gsName) & " - SSN: " & gsSSN
    sSTime = CStr(FormatDateTime(CDate(cboTime), vbShortTime))
    Set oWorkSpace = CreateObject("Notes.NOTESUIWORKSPACE")
    Set oCalenDoc = oWorkSpace.COMPOSEDOCUMENT(gsMailServer, gsMailFile, "Appointment")
   
    'set calendar entry to 'reminder' appointment type
    oCalenDoc.FIELDSETTEXT "AppointmentType", "4"
    oCalenDoc.Refresh
   
    '-----------------------------------------------
    ' assign values to date/time entry fields
    ' loop count is done to prevent endless loop
    '-----------------------------------------------
    Do Until (CDate(Right(oCalenDoc.FIELDGETTEXT("StartDate"), 10)) = CDate(txtDate)) Or iLoop = 1000
        oCalenDoc.FIELDSETTEXT "StartDate", CStr(FormatDateTime(txtDate, vbShortDate))
        oCalenDoc.Refresh
        iLoop = iLoop + 1
    Loop
    iLoop = 0
   
    Do Until (CDate(oCalenDoc.FIELDGETTEXT("StartTime")) = CDate(sSTime)) Or iLoop = 1000
        oCalenDoc.FIELDSETTEXT "StartTime", sSTime
        oCalenDoc.Refresh
        iLoop = iLoop + 1
    Loop
    iLoop = 0
   
    Do Until (CDate(Right(oCalenDoc.FIELDGETTEXT("EndDate"), 10)) = CDate(txtDate)) Or iLoop = 1000
        oCalenDoc.FIELDSETTEXT "EndDate", CStr(FormatDateTime(txtDate, vbShortDate))
        oCalenDoc.Refresh
        iLoop = iLoop + 1
    Loop
    iLoop = 0
   
    Do Until (CDate(oCalenDoc.FIELDGETTEXT("EndTime")) = CDate(sSTime)) Or iLoop = 1000
        oCalenDoc.FIELDSETTEXT "EndTime", sSTime
        oCalenDoc.Refresh
        iLoop = iLoop + 1
    Loop
   
    '-----------------------------------------------
    ' assign remaining values and save entry
    '-----------------------------------------------
    oCalenDoc.FIELDSETTEXT "Subject", sSubject
    oCalenDoc.FIELDSETTEXT "Body", sBody
    oCalenDoc.Refresh
    oCalenDoc.Save
    oCalenDoc.Close
   
    '-----------------------------------------------
    ' delete references
    '-----------------------------------------------
    If oCalenDoc Is Nothing = False Then
        Set oCalenDoc = Nothing
    End If
    If oWorkSpace Is Nothing = False Then
        Set oWorkSpace = Nothing
    End If

    '----------------------------------------
    'update the return value
    '----------------------------------------
    ScheduleCallBack = True
    MsgBox "Call Back has been scheduled for " & txtDate & " " & cboTime & ".", vbInformation + vbOKOnly, "Information"

NormalExit:
    Screen.MousePointer = vbDefault
    Exit Function

ErrHandler:
    gsShowError Err.Number, Err.Description, "ScheduleCallBack"
    ScheduleCallBack = False
    Resume NormalExit
   
End Function
0
Comment
Question by:jfvon
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 63

Accepted Solution

by:
SysExpert earned 500 total points
ID: 18763767
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Problem "Can you help me recover my changes?  I double-clicked the attachment, made changes, and then hit Save before closing it.  But when I try to re-open it, my changes are missing!"    Solution This solution opens the Outlook Secure Temp Fold…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question