Subject: RE: How do I extract files …
Here a complete sample - this goes through every doc in a view and removes all the attachments.
Dim s As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim object As NotesEmbeddedObject
Set db = s.CurrentDatabase
Dim view As NotesView
Set view = db.GetView( “MainView” ) ’ <— name of view goes here
view.AutoUpdate = False
'Iterate Through View
view.AutoUpdate = False
Set doc = view.GetFirstDocument
While Not ( doc Is Nothing )
filenames=Evaluate(“@AttachmentNames”,doc)
numberoffiles=Evaluate(“@Attachments”, doc)
If numberoffiles(0)>0 Then
For filecounter=0 To numberoffiles(0)-1
Print filenames(filecounter)
Set object = doc.GetAttachment( filenames(filecounter) )
If ( object.Type = EMBED_ATTACHMENT ) Then
fileCount = fileCount + 1
Call object.ExtractFile(Left((Trim(s.getEnvironmentString(“Directory”, True))),3) & filenames(filecounter) ) ’
Call object.remove 'rem this to just extract the attachments
Call doc.save(True,False)
End If
Next filecounter
Msgbox "Total Files Detatched: " & Cstr(fileCount)
End If
Set doc = view.GetNextDocument(doc)
Wend
view.AutoUpdate = True