AddAttachment

설명

Attachment 오브젝트를 콜렉션에 추가합니다.

주: 이 메소드는 Perl 전용입니다.

이 메소드는 파일의 새 Attachment 오브젝트를 작성한 후 오브젝트를 콜렉션에 끝에 추가합니다. Item 메소드를 사용하여 콜렉션에서 항목을 검색할 수 있습니다.

구문

Perl

$attachments->AddAttachment(filename, description); 
ID
설명
attachments
레코드의 한 필드에 있는 첨부 세트를 나타내는 Attachments 콜렉션 오브젝트.
filename
이 필드에 추가할 파일의 절대 또는 상대적 경로 이름을 포함하는 문자열.
description
첨부된 파일의 특징에 대해 기술하는 임의의 텍스트를 포함하는 문자열.
Return value
파일이 추가된 경우에는 True, 그렇지 않은 경우에는 False를 리턴하는 부울.

예제

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

피드백