getAttachment (NotesDocument - JavaScript)

添付ファイルを表すものを返します。

定義場所

NotesDocument

構文

getAttachment(filename:string) : NotesEmbeddedObject
パラメータ 説明
filename 添付ファイルのファイル名です。
戻り値 説明
NotesEmbeddedObject 添付ファイルを表すものを返します。指定された名前の添付ファイルがない場合は、null を返します。

使用法

このメソッドは、リッチテキストアイテム内に含まれている添付ファイルだけでなく、リッチテキストアイテムに含まれていない添付ファイル (リリース 2 データベースの添付ファイルなど) の検索に使用できます。

返された NotesEmbeddedObjectParent プロパティは、NotesRichTextItem を使用してアクセスされたものではないため、null を返します。

以下のボタンは、現在のデータベース内の文書で、指定された添付ファイルを検索します。
try {

var dc:NotesDocumentCollection = database.getAllDocuments();
var doc:NotesDocument = NotesDocument = dc.getFirstDocument();
while (doc != null) {
	var obj:NotesEmbeddedObject = doc.getAttachment(requestScope.query);
	if (obj != null) {
		requestScope.status = "Found " + obj.getName() + " in ¥"" + 
			doc.getItemValueString("Subject") + "¥"";
		break;
	}
	var tmpdoc = dc.getNextDocument();
	doc.recycle(); // recycle to avoid memory problems
	doc = tmpdoc;
}
if (!requestScope.status.startsWith("Found")) {
	requestScope.status += "¥nDid not find attachment"
}

} catch(e) {
	requestScope.status = e.toString();
}

言語間の参照

LotusScript® NotesDocument クラスの GetAttachment メソッド

Java™ Document クラスの getAttachment メソッド