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

  • Favorite iSeries cheat sheets

    Here you'll find a collection of valuable cheat sheets gathered from across the iSeries/Search400.com community. These cheat ...

  • HTML cheat sheet

    This is a really cool cheat sheet if you're looking to learn more about HTML. You'll find just about everything you every wanted ...

  • Carol Woodbury: Security

    Carol Woodbury

SearchDataCenter

SearchContentManagement

Close