Subject: RE: Getting Field Values in LS
Hi Keshava,
I have so far managed to put together this code.
But I would have expected the code to have generated 2 documents as there are 2 values in the field AlarmDialog
Error - Type mismatch
Sub Click(Source As Button)
'Set Dimensions
Dim session As New NotesSession
Dim workspace As New NotesUIWorkspace
Dim db As NotesDatabase
Dim doc2 As NotesDocument
Dim item As NotesItem
'Get Current Document to work on
Dim uidoc As NotesUIDocument
Dim doc As NotesDocument
Set uidoc = workspace.CurrentDocument
Set doc = uidoc.Document
'Save current document
Call uidoc.Save
'Get Values in Field
Dim names As String
Dim altnames As String
names = doc.FieldGetText( "AlarmDialog" )
names = names+","
altnames = Strleft(names, ",")
If altnames <> "" Then
While altnames <> ""
names =Strright(names , ",")
altnames = Strleft(names, ",")
'*************************************************
'This is where I woulld use the name to lookup their mailfile & server
' Then create the doc in their database
'*************************************************
Set db = session.GetDatabase("Spinoza" , "mail\pthomas.nsf")
'Create mini-doc
Set doc2 = New NotesDocument(db)
Set item = doc.GetFirstItem("$Alarm")
Call item.CopyItemToDocument(doc2, "$Alarm")
Set item = doc.GetFirstItem("$AlarmOffset")
Call item.CopyItemToDocument(doc2, "$AlarmOffset")
Set item = doc.GetFirstItem("CalendarDateTime")
Call item.CopyItemToDocument(doc2, "CalendarDateTime")
Set item = doc.GetFirstItem("Subject")
Call item.CopyItemToDocument(doc2, "Subject")
'Save and move mini-doc to folder
Call doc2.Save(True , False , True)
Call doc2.PutInFolder ("($Alarms)")
'Close original document
Call uidoc.Close
Wend
End If
End Sub