Detach all attached files in selected documents
Detach all attached files in selected documents
Here is a very useful LotusScript view action that will detach all the attached files of selected documents in a view to a designated folder in the user's hard drive. The function can be made even more useful by retrieving the path name from a profile document, an environment variable or a user prompt.
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 NotesRichTextItem Set db = session.CurrentDatabase ' ' The path name can be retrieved from a profile document,
environment variable or a user prompt. ' PathName$ = "C:/TDD/" ' ' Set collection to all selected documents Set collection = db.UnprocessedDocuments ' ' Process each selected document ' For i = 1 To collection.Count Set doc = collection.GetNthdocument(i) Set rtitem = doc.GetFirstItem( "Body" ) If (rtitem.Type = RICHTEXT ) Then ' ' Detach all attachments in the document ' Forall o In rtItem.EmbeddedObjects Fname$=o.Name Call o.ExtractFile(PathName$&Fname$) End Forall End If Next Messagebox("Files detached to "&PathName$) End Sub