How do I extract files

This goes pack to the corrupted RichText/paragraph issue of my last post. I’ve gotten most of the way through the issue, but need one more bit of assistance. ** How do I extract files that are not part of a RT field or NotesDocument.

When I try EmbeddedObjects in either the form or the RT field an error is raised. But I can get the first $File object.

How would you proceed?

Subject: How do I extract files …

Have you tried this?

First use Evaluate to get all attachments:

vEval = Evaluate(“@AttachmentNames”, doc)

ForAll v In vEval

Set embObject = doc.GetAttachment(v)

…and so on…

End ForAll

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