To continue reading for free, register below or login
To read more you must become a member of SearchDomino.com
');
// -->

I assume that you mean you want to email the attachments to a Lotus Notes mailbox of your choice, as putting them in a folder on the file system is a completely different issue. But, here is how to do both both:
To begin with, creating a directory is easy. LotusScript provides the MkDir command, which takes the pathname of the new folder as a parameter. If appropriate, use the Dir$ command to check to see if the directory (or files within it) already exists.
Now, to extract all attachments, just get a handle to the rich text document and use code similar to the following…
If Not Isempty(rtitem.embeddedObjects)
Then
Forall o In rtitem.EmbeddedObjects
If ( o.Type = EMBED_ATTACHMENT )
Then
Call o.ExtractFile ( AttachmentDirectory+
"\"+o.name )
End If
End Forall
The test to see if the object is an embedded attachment must be done. Otherwise, the code would trip over any files embedded as OLE objects (which cannot be detached).
Keep in mind that if you have an old pre-R5 Lotus Notes database, attachments may be stored in the documents object collection, instead of those for the rich text field. In theory, the same concepts apply; you just cannot pick a particular rich-text field to extract from. (See the Designer Help for more detail, if needed.)
Do you have comments on this Ask the Expert Q&A? Let us know.
Related information from SearchDomino.com:
Tip: Extract attachments and indicate a new location
Expert Advice: Extracting and reattaching attachments
FAQ: LotusScript advice
Reference Center: LotusScript tips and resources
|