Populate date time to new calendar entry

The script below is trying to pass values like date, time, subject… it copies these values (except date and time) to a new calendar entry.

When I looked at my calendar, only the subject field has been populated. Other fields like startdate, starttime is not showing up. I am using R6.5.2 notes client/server.

Anyone can tell me how to pass date and time values from one database to a new calendar entry…


Sub Click(Source As Button)

Dim uiWorkspace As New NotesUIWorkspace

Dim dateTime As NotesDateTime

Dim item As NotesItem

Dim session As New NotesSession

Dim db As NotesDatabase

Dim view As NotesView

Dim doc As NotesDocument



'script to get existing variables to populate into calendar from New View

Set db = session.CurrentDatabase

Set view = db.GetView("AllC")

Set doc = view.GetFirstDocument

Set doc = session.DocumentContext

VCourse=doc.Course(0)

VStartDate=doc.EventStartDate(0)

VEndDate=doc.EventEndDate(0)

VStartTime=doc.EventStartTime(0)

VEndTime=doc.EventEndTime(0)



Call uiworkspace.openDatabase(	"AG2/Server/VIC-AUD-GEN/AU","mail\jang.nsf","Calendar","",True,False)

Set db = session.CurrentDatabase

Set doc = New NotesDocument ( db )



'Set dateTime = New NotesDateTime( VStartTime )



doc.Form = "Appointment"

doc.Subject=VCourse

doc.StartDate=VStartDate

doc.StartTime =VStartTime

doc.Starttime_2=VStartTime

doc.StartDate_2=VStartDate

doc.EndDate =VEndDate

doc.EndDate_2=VEndDate

doc.EndTime =VEndTime

doc.EndTime_2=VEndTime

Call doc.Save( True, True )	

End Sub

Subject: populate date time to new calendar entry

there is problem with lotus notes when it comes to date/time fields. the designer date/time field is incompatible with notesdatetime class as both have different storage formats.

the solution for this is to have a different date/time field created in lotusscript for displaying calendar entries.

HTH

-Shiva.

Subject: RE: populate date time to new calendar entry

can anyone give me an example? Or more detail information on how to handle date/time fields in lotus script

Subject: RE: populate date time to new calendar entry

right. I’ll give you an example from your own code. check the comments.

doc.Form = "Appointment"

doc.Subject=VCourse

’ doc.StartDate=VStartDate

’ doc.StartTime =VStartTime

’ doc.Starttime_2=VStartTime

’ doc.StartDate_2=VStartDate

’ doc.EndDate =VEndDate

’ doc.EndDate_2=VEndDate

’ doc.EndTime =VEndTime

’ doc.EndTime_2=VEndTime

' Instead of directly writing to the designer Date/Time fields create seperate NotesItem and 

'populate with NotesDateTime field values

Set dateTime = New NotesDateTime( VStartDate)

Set item = New NotesItem(doc, "dispStartDate", dateTime.DateOnly)

Set dateTime = New NotesDateTime( VStartTime)

Set item = New NotesItem(doc, "dispStartTime", dateTime.TimeOnly)

Set dateTime = New NotesDateTime( VEndDate)

Set item = New NotesItem(doc, "dispEndDate", dateTime.DateOnly)

Set dateTime = New NotesDateTime( VEndTime)

Set item = New NotesItem(doc, "dispEndDate", dateTime.TimeOnly)



Call doc.Save( True, True )

'— end of code

And then use the dispxxx items to display date/time in the calendar views.