콜렉션에서 첨부 파일을 삭제합니다.
VBScript의 경우, 이 메소드에 대한 인수는 숫자 색인(itemNum) 또는 표시 이름(displayName)일 수 있습니다. Perl의 경우, 인수는 숫자 색인이어야 합니다.
이 메소드를 호출하여 Count 및 Item 메소드를 사용하여 올바른 Attachment 오브젝트를 찾을 수 있습니다.
VBScript
attachments.Delete itemNum
attachments.Delete displayName
Perl
$attachments->Delete(itemNum);
VBScript
' This example assumes there is at least 1 attachment field in this record type,
' and at least one attachment associated with this record.
' NOTE: The entity must be in an editable state to delete an attachment -- see above.
set currentSession = GetSession set attachFields = AttachmentFields
set attachField1 = attachFields.Item(0)
set theAttachments = attachField1.Attachments
If Not theAttachments.Delete(0) Then
OutputDebugString "Error deleting the attachment."
End If
Perl
# This example assumes there is at least 1 attachment field in this record type,
# and at least one attachment associated with this record.
# NOTE: The Entity must be in an editable state to delete an attachment -- see above.
# 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
$attachments = $attachfield1->GetAttachments();
# Delete the first attachment
if (!$attachments->Delete(0)) {
$session->OutputDebugString("Error deleting attachment from record.\n");
}