FileName

説明

添付されたファイルのパス名を戻します。

これは読み取り専用のプロパティです。表示できますが設定できません。

添付ファイルがデータベースにコミットされた前は、このプロパティにはファイルのオリジナルのパス名が含まれています。しかし、添付ファイルがコミットされると、ファイルはファイル システムではなくデータベースに存在するために、パス情報は削除されます。例えば、ファイル C:projectsmyfilesexample.txt を追加すると、レコードがコミットされるまではこのフルネームとなっていますが、コミットされると名前は example.txt に短縮されます。

名前が同じで、パス情報が異なる 2 つのファイルを同一データベースに追加することは、 Rational® ClearQuest® 上、問題ありません。 Rational ClearQuestは、ファイルを内部で特定する場合に、ファイル名のみを頼りにしているのではありません。

構文

VBScript

attachment.FileName 

Perl

$attachment->GetFileName(); 
識別子
説明
attachment
レコードへのファイルの添付を表す、Attachment オブジェクト。
戻り値
添付されたファイルの名前を含む String。

VBScript

' This example assumes there is at least 1 attachment field 
' and 1 attachment associated with the record. 
set currentSession = GetSession

set attachFields = AttachmentFields
set attachField1 = attachFields.Item(0) 
set theAttachments = attachField1.Attachments 
For each attachment in theAttachments
     set thefileName = attachment.FileName 
     set thefileSize = attachment.FileSize 
     currentSession.OutputDebugString "Attached file: " & _
          thefileName & " - size: " & thefileSize 
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 fields
$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++)
 {
 # Retrieve the correct attachment
 $attachment = $attachments->Item($x);

 # Get the filename and filesize for the attachment and print out
     # the results
 $filename = $attachment->GetFileName(); 
 $filesize = $attachment->GetFileSize();
 $session->OutputDebugString("Attached file: ".$filename." - 
          size: ".$filesize);
 } 


フィードバック