Manage Learn to apply best practices and optimize your operations.

Notes View on the Web

This code will read a view and write selected fields out as a text file on the server then attach the file to a document while working from the Web. This allows users working from the Internet to download the attached text file and import it into a non-Lotus Notes product.

Sub Initialize
Dim Session As New NotesSession
Dim db As NotesDatabase
Dim View As NotesView
Dim rtitem As Variant
Dim plainText(4) As Variant
Dim fileNum As Integer
Dim item As NotesItem
Dim doc As NotesDocument
Dim rtitem1 As NotesRichTextItem
Dim object As NotesEmbeddedObject

Set db = Session.CurrentDatabase
Set View = db.GetView("AttendeesXL")
Set doc = View.GetFirstDocument

'declare file for output
fileNum = Freefile
Open "C:\NotesData.TXT" For Output As fileNum

'Loop through the view
While Not(doc Is Nothing)
Set doc2 = View.GetNextDocument(doc)

Set item = doc.GetFirstItem("lname")
plainText(1) = item.Text
Set item = doc.GetFirstItem("name")
plainText(2) = item.Text
Set item = doc.GetFirstItem("rank")
plainText(3) = item.Text

Write #fileNum, plainText(1), plainText(2), plainText(3)
Set doc = doc2
Close #fileNum

'The following imports the text file and attach to a document
Set doc = New NotesDocument(db)
Set rtitem1 = New NotesRichTextItem(doc, "BodyAtt")
Set object = rtitem1.Embedobject(EMBED_ATTACHMENT, "" , "C:\NotesData.TXT")

doc.Form = "DataTrForm"
Call doc.Save(True, True)


End Sub

Dig Deeper on Domino Resources - Part 2

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.




  • iSeries tutorials's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...