AddAttachment

Description

Añade un objeto Attachment a la recopilación.

Nota: Este método sólo es para Perl.

Este método crea un nuevo objeto Attachment para el archivo y añade el objeto al final de la recopilación. Puede recuperar elementos de la recopilación utilizando el método Item.

Sintaxis

Perl

$attachments->AddAttachment(filename, description); 
Identificador
Description
attachments
Objeto de recopilación Attachments que representa el conjunto de archivos de datos adjuntos de un campo de un registro.
fileName
Un valor String que contiene el nombre de vía de acceso absoluto y relativo del archivo que se va a adjuntar al campo.
descripción
Un valor String que contiene texto arbitrario que describe la naturaleza del archivo adjunto.
Valor de retorno
Un valor Boolean que es True si el archivo se ha añadido satisfactoriamente y, de lo contrario, devuelve False.

Ejemplo

Perl

# This example assumes that there is at least
# one attachment field associated with the record
# For this entity record, get the collection of all
# attachment fields

$attachfields = $entity->GetAttachmentFields();

# Work with the first attachment field

$attachfield1 = $attachfields->Item(0);

# For this attachment field, get the collection of all
# its attachments

$theAttachments = $attachfield1->GetAttachments();

# Add the designated file and description to the 
# attachments field

if (!$theAttachments->AddAttachment("c:\\attach1.txt","attachment description"))
 {

$session->OutputDebugString("Error adding attachment to record.\n");
 } 

Comentarios