Hello All-
In my script below I am trying to gather information from each document in the Calendar view and write it to a ~ delimited txt file.
The script seems to be falling out of the initial loop.
There are three document in the view currently.
Do you see any reason why it bails?
Thanks
Pat
Sub Initialize
Dim Session As NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim doc As NotesDocument
Dim xxAppointmentType As String
Dim TaskType As Variant
Dim xxLocation As Variant
Dim xxChair As Variant
Dim xxRoom As Variant
Dim xxSubject As Variant
Dim ExpValue As String
Dim CalEntry As String
Set Session = New NotesSession
Set db = session.CurrentDatabase
Set View = db.GetView("($Calendar)")
Set doc = view.GetFirstDocument
' Get an unused file number so LotusScript can open a file.
Dim fileNum As Integer, I As Integer
Dim fileName As String
fileNum% = Freefile()
fileName$ = "C:\tmp\" & doc.UniversalID & ".txt"
’ Write out some employee data.
Open fileName$ For Output As fileNum%
Do Until Not(doc Is Nothing)
Const NotesMacro1$ = "@Name([Abbreviate];@Subset(Room;1))"
Const NotesMacro2$ = "@Name([CN];Chair)"
TaskType = doc.getItemValue("TaskType")
'xxAppointmentType = doc.getItemValue("AppointmentType")
xxRoom = doc.Room(0)
xxChair = doc.Chair(0)
xxSubject = doc.Subject(0)
If xxAppointmentType<>"3" Then
Goto flag
Else
xxRoom = "Room: " & Evaluate(NotesMacro1$, doc)
End If
If xxAppointmentType = "3" Then
xxChair = "Chair: " & Evaluate(NotesMacro2$, doc)
Elseif TaskType = "2" Then
xxChair = "Owner: " & Evaluate(NotesMacro2$, doc)
End If
flag:
If Not Isnull(doc.Location) Then
xxLocation = "Location: " & doc.Location(0)
Else
xxLocation = ""
End If
CalEntry = xxSubject & "~" & xxRoom & "~" & xxLocation & "~" & xxChair
'Messagebox (CalEntry)
ExpValue = doc.StartDateTime(0) & "~" & doc.EndDateTime(0) & "~" & CalEntry
'Messagebox (ExpValue)
Write #fileNum%, ExpValue
Loop
Close fileNum%
End Sub