Solved

Lotus Notes Calendar Programming from Visual Basic

Posted on 2007-03-21
1
1,401 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

I thought it will be a good idea to make a post as it will help in case someone else faces these issues. I trust this gives an idea how each entry in Notes.ini can mean a lot for the Domino Server to be functioning properly. This article discusses t…
Notes Document Link used by IBM Notes is a link file which aids in the sharing of links to documents in email and webpages. The posts describe the importance and steps to create a Lotus Notes NDL file in brief.
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

860 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