AddAttachment

説明

コレクションに Attachment オブジェクトを追加します。

注: このメソッドは Perl 専用です。

このメソッドは、ファイル用の新規 Attachment オブジェクトを作成して、コレクションの最後にオブジェクトを追加します。コレクションからアイテムを取得するには、Item メソッドを使用します。

構文

Perl

$attachments->AddAttachment(filename, description); 
識別子
説明
attachments
Attachments コレクション オブジェクト。レコードの 1 つのフィールドの添付ファイルのセットを表します。
filename
このフィールドに添付されるファイルの絶対または相対パス名を含む String。
description
添付ファイルの性質を説明する任意のテキストを含む String。
戻り値
ファイルが正常に追加された場合は True、そうでない場合は False の Boolean。

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");
 } 

フィードバック