Solved

Lotus Notes Calendar Programming from Visual Basic

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

  In today’s Arena we can’t imagine our lives without Internet as we are highly used to of it. If we consider our life style just for only 2 min we found that face to face communication is swapped by e-communication.  Every Where from Works place to…
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…
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…

919 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