Solved

Lotus Notes Calendar Programming from Visual Basic

Posted on 2007-03-21
1
1,380 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
1 Comment
 
LVL 63

Accepted Solution

by:
SysExpert earned 500 total points
ID: 18763767
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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 utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

758 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now