Notes 添付ファイル

Bookmark this on Delicious
このエントリーをはてなブックマークに追加
はてなブックマーク - Notes 添付ファイル

ノーツ移行に伴って添付ファイル一括書き出しを書いたのでメモ
Viewアクションから実行
文書IDごとにディレクトリを切って添付ファイルを保存
これですむといいな。

Sub Click(Source As Button)
	Dim session As New NotesSession
	Dim db As NotesDatabase
	Dim collection As NotesDocumentCollection
	Dim doc As NotesDocument
	Dim rtitem As Variant
	Dim itemname As Variant
	Dim item As NotesItem
	Dim object As NotesEmbeddedObject
 
	Set db = session.CurrentDatabase
	Set collection = db.UnprocessedDocuments
 
	For i = 1 To collection.Count
		Set doc = collection.GetNthDocument( i )
		If doc.HasEmbedded Then
			Do While doc.HasItem( "$FILE" )
				Set item = doc.GetFirstItem( "$FILE" )
				If item.Type = ATTACHMENT Then
					folderpath = "c:\temp" & "\" & doc.universalid
					If Dir(folderpath,16)="" Then
						Mkdir folderpath
					End If
					itemname = doc.GetItemValue( "$FILE" )
						Set object = doc.GetAttachment( itemname(0) )
					Call object.ExtractFile( folderpath & "\" & itemname(0))
				End If
				Call item.Remove
			Loop
		End If
	Next
End Sub

関連記事:

コメントをどうぞ

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です

*

次のHTML タグと属性が使えます: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <img localsrc="" alt=""> <pre lang="" line="" escaped="" highlight="">

Additional comments powered byBackType