Attachments
Description
Returns this attachment field's collection of attachments.
This is a read-only property; the value can be viewed but not set. However, you can still add items to (and remove items from) the collection using methods of the Attachments object.
This property always returns an Attachments object,
even if there are no attached files associated with the field. If the field
has no attached files, the Count method
of the Attachments object contains the value zero.
Syntax
Perl
$attachmentField->GetAttachments();
- Identifier
- Description
- attachmentField
- An AttachmentField object representing one attachment field of a record.
- Return value
- An Attachments collection object, which itself contains a set of Attachment Objects.
Example
Perl
# This example assumes that there is at least 1 attachment
# field associated with the record. Otherwise,
# GetAttachmentFields won't return anything interesting and an
# error would be generated
# Get the collection of attachment fields
$attachfields = $entity->GetAttachmentFields();
# Get the first attachment field
$attachfield1 = $attachfields->Item(0)
# Now get the collection of attachments from the attachments field
$attachments = $attachfield1->GetAttachments();
# Retrieve the number of attachments for the for loop
$numattachments = $attachments->Count();
for ($x = 0 ; $x < $numattachments ; $x++)
{
$attachment = $attachments->Item($x);
# ...do some work with $attachment
}