Working with attachments and embedded objects in LotusScript® classes

File attachments and embedded objects are represented through the NotesEmbeddedObject.

Note: Embedded objects and object links are not supported for UNIX, and the Macintosh. File attachments are.

To access an attachment in a rich text item, do one of the following:

  • Use the NotesRichTextNavigator methods in conjunction with the type RTELEM_TYPE_ATTACHMENT. An element obtained in this manner is an object of type NotesEmbeddedObject whose Type property is EMBED_ATTACHMENT.
  • Use the EmbeddedObjects property of NotesRichTextItem. This property is an array of objects of type NotesEmbeddedObject. Use the array elements whose Type property is EMBED_ATTACHMENT.

To access an embedded object in a rich text item, do one of the following:

  • Use the NotesRichTextItem methods in conjunction with the type RTELEM_TYPE_OLE. An element obtained in this manner is an object of type NotesRichTextItem whose NotesRichTextItem is EMBED_OBJECT or EMBED_OBJECTLINK.
  • Use the NotesRichTextItem of NotesRichTextItem. This property is an array of objects of type NotesEmbeddedObject. Use the array elements whose Type property is EMBED_OBJECT or EMBED_OBJECTLINK.

To create an attachment or embedded object in a rich text item, use EmbedObject of NotesRichTextItem.

The HasEmbedded property of NotesDocument indicates whether a document contains any attachments or embedded objects.

To get all the embedded objects in a document, including objects that were originally embedded in the form from which the document was created, use the EmbeddedObjects property of NotesDocument.

To locate pre-R4 file attachments not associated with a rich text item, get all the items in the document, for example, by using the Items property of NotesDocument. Test the Type property of each item for ATTACHMENT. To get an attachment of this type, use the GetAttachment method of NotesDocument.

The following properties and methods of NotesEmbeddedObject apply to both attachments and embedded objects:

  • Name (read-only String) is the reference name for the object.

  • Parent (read-only NotesRichTextItem) is the rich text item that contains the object.
  • Source (read-only String) is the file name for attachments and the Notes® internal name for embedded objects.
  • Type (read-only Integer) is EMBED_OBJECTLINK, EMBED_ATTACHMENT, or EMBED_OBJECT.
  • Remove removes the object from its rich text item.

The following property and method of NotesEmbeddedObject apply to attachments only:

  • FileSize (read-only Long) is the byte size of the file.
  • ExtractFile writes a file attachment to a file.

The following properties and methods of NotesEmbeddedObject apply to embedded objects only:

  • Class (read-only String) is the name of the application that created the object.
  • FitBelowFields (read-write boolean), if True, sizes an OLE control to take over the screen below the first layout region.
  • FitToWindow (read-write boolean), if True, sizes an OLE control to take over the screen.
  • Object (read-only Variant) is the OLE handle for the object, if it is in memory.
  • RunReadOnly (read-write boolean), if True, runs an embedded object when reading the containing document.
  • Verbs (read-only array of type String) contains the verbs supported by the object.
  • Activate loads the object and returns a handle to it.
  • DoVerb executes an object verb.