Attachments

説明

この添付ファイル フィールドの添付ファイルのコレクションを戻します。

これは読み取り専用のプロパティです。値は表示できますが設定できません。ただし、Attachments オブジェクトのメソッドを使用して、アイテムをコレクションに追加 (またはアイテムを削除) することは依然として可能です。

このプロパティは、フィールドに関連したファイルが添付されていない場合でも、常に Attachments オブジェクトを戻します。フィールドにファイルが添付されていない場合、Attachments オブジェクトの Count メソッドには、値ゼロが含まれます。

構文

VBScript

attachmentField.Attachments 

Perl

$attachmentField->GetAttachments(); 
識別子
説明
attachmentField
AttachmentField オブジェクトは、レコードの 1 つの添付ファイル フィールドを表します。
戻り値
Attachments コレクション オブジェクト。これ自体に Attachment オブジェクトのセットが含まれます。

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 

For each attachment in theAttachments 
     'Do something with each attachment 
Next

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
 } 

フィードバック