例: ExtractFile method

次のスクリプトは文書の Body アイテムにある 100,000 バイトより大きい添付ファイルをすべて移動して削除します。例えば、最初に検索された添付ファイルは c:¥reports¥newfile1 に移動され、次に検索された添付ファイルは c:¥reports¥newfile2 に移動されます。

Dim doc As NotesDocument
Dim rtitem As Variant
Dim fileCount As Integer
Const MAX = 100000
fileCount = 0    
'...set value of doc...
Set rtitem = doc.GetFirstItem( "Body" )
If ( rtitem.Type = RICHTEXT ) Then
  Forall o In rtitem.EmbeddedObjects
    If ( o.Type = EMBED_ATTACHMENT ) _
    And ( o.FileSize > MAX ) Then
      fileCount = fileCount + 1
      Call o.ExtractFile _
      ( "c:¥reports¥newfile" & Cstr(fileCount) )
      Call o.Remove
      Call doc.Save( True, True )
    End If
  End Forall
End If