18.01.2013 Views

LotusScript for Visual Basic Programmers - IBM Redbooks

LotusScript for Visual Basic Programmers - IBM Redbooks

LotusScript for Visual Basic Programmers - IBM Redbooks

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Accessing the Document Properties<br />

Notes classes provide different NotesDocument properties than provided<br />

by HiTest. Only EncryptOnSend, EncryptionKeys, SaveMessageOnSend,<br />

and SignOnSend are read-write properties. The other properties are<br />

read-only properties.<br />

For more detailed in<strong>for</strong>mation on NotesDocument, refer to Chapter 3.<br />

Let’s look at an example.<br />

Example<br />

This agent example displays the properties of the first document in the<br />

TEST database.<br />

Dim session As Object<br />

Dim db As Object<br />

Dim dc As Object<br />

Dim doc As Object<br />

Set session = CreateObject ("Notes.NotesSession")<br />

Set db = session.GetDatabase ("","test.nsf")<br />

Set dc = db.AllDocuments<br />

Set doc = dc.GetFirstDocument(1247)<br />

Print ( "Created: " & doc.Created)<br />

Print ( "Last modified: " & doc.LastModified)<br />

Print ("Note ID: " & doc.NoteID)<br />

Following is an explanation of the code.<br />

We declare dc as an object which will reference the document collection in<br />

the database.<br />

Dim dc As Object<br />

We declare doc as an object which will reference the Notes document. It<br />

descends from NotesDocumentCollection.<br />

Dim doc As Object<br />

We get a reference to NotesDocument Collection from the AllDocument<br />

method of NotesDatabase.<br />

Set dc = db.AllDocuments<br />

We get a reference to the first document using the GetFirstDocument<br />

method of the NotesDocument Collection object and store it in doc. 1247<br />

refers to the database type.<br />

152 <strong>LotusScript</strong> <strong>for</strong> <strong>Visual</strong> <strong>Basic</strong> <strong>Programmers</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!