Manage Learn to apply best practices and optimize your operations.

A Script To Copy One Document To Another, Including Richtext Items And File Attachments

When you forward a document to a person, the contents of that document
(including file attachments) render correctly. However, when you try to do the
same programmitaclly through a formula or a script, you might get into
problems, especially with file attachments.

Below is a script I use which takes care of the problem.
The script below is self-explanatory.

Sub CopyAllDocItems(Source As notesdocument, dist As notesdocument)

Dim rtitemA As Variant
Dim rtitemB As Variant

Forall i In Source.items
ItemName = i.name
If Not i.name = "$FILE" Then 'Takes care of where
there is an attachment in RTF fields
If i.type = RICHTEXT Then
Set rtitemA = Source.GetFirstItem( i.Name)
Set rtitemB = New NotesRichTextItem ( Dist, i.Name )
Call rtitemB.AppendRTItem( rtitemA )
Else
Set notesItem = i.CopyItemToDocument( Dist, i.Name )
End If
End If
End Forall

End Sub



One possible use of this script is to mail a copy of a document to several
people at the same time through an agent which contains statement such as (in
meta code):

get a list of recipients in RecipientsList
set current document as docA
For all recipent in RecipientsList
Create new document instant as docB
Call CopyAllDocItems(DocA, DocB)
Set DocB.To = Recipient
send DocB
end loop

Dig Deeper on Domino Resources - Part 2

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com'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 ...

SearchDataCenter

SearchContentManagement

Close