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.

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

We declare doc_src and doc_dest which will reference the source (first)<br />

document and destination (second) document in the By Author View.<br />

Dim doc_src As Object<br />

Dim doc_dest As Object<br />

We declare item as an object which will reference the Subject item in the<br />

source document.<br />

Dim item As Object<br />

We get the reference to the source and destination documents using the<br />

view’s methods:<br />

Set doc_src = view.GetFirstDocument()<br />

Set doc_dest = view.GetNextDocument(doc_src)<br />

We get the Subject item using the GetFirstItem method of NotesDocument.<br />

Set item = doc_src.GetFirstItem("Subject")<br />

We copy the Subject item of the source document to the destination<br />

document.<br />

Call item.CopyItemToDocument(doc_dest, "Subject")<br />

We remove the Subject item in the source document using the Remove<br />

method of NotesItem.<br />

Call item.Remove<br />

Deleting an Item<br />

Use either the Remove method of the NotesItem class or the RemoveItem<br />

method of NotesDocument to remove an item from a document. The<br />

Remove method removes only the current object; other items with the same<br />

name remain in existence. The RemoveItem method removes all items with<br />

the specified name.<br />

After removing an item, you must call the Save method <strong>for</strong> the<br />

NotesDocument object that contained the item or the update is lost when<br />

the program exits.<br />

For an example, refer to the section on how to copy an item using Notes<br />

classes through OLE automation.<br />

168 <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!