Add

Description

Adds an Attachment object to the collection.

Note: This method is for Visual Basic only.

This method creates a new Attachment object for the file and adds the object to the end of the collection. You can retrieve items from the collection using the Item method.

Syntax

VBScript


attachments.Add filename, description 
Identifier
Description
attachments
An Attachments collection object, representing the set of attachments in one field of a record.
filename
A String containing the absolute or relative pathname of the file to be attached to this field.
description
A String that contains arbitrary text describing the nature of the attached file.
Return value
A Boolean that is True if the file was added successfully, otherwise False.

Example

VBScript

' This example assumes there is at least 1 attachment field 
' associated with the record. 
set currentSession = GetSession
set attachFields = AttachmentFields 
set attachField1 = attachFields.Item(0) 

set theAttachments = attachField1.Attachments 
If Not theAttachments.Add("c:\attach1.txt", "Defect description") Then 
  OutputDebugString "Error adding attachment to record." 
End If