Lotus Notes Archiving: Emails WITH Attachments

0 pts.
Tags:
Lotus Domino
I'd like to be able to archive all the emails in a folder with attachments included, and be able to save the PDF to a user-selectable location. Does anybody know of software or scripts that can help me do this?
ASKED: July 26, 2006  8:43 PM
UPDATED: October 13, 2009  1:32 PM

Answer Wiki

Thanks. We'll let you know when a new response is added.

Here’s some code that might help you get started, its for extracting attachments out of emails and makes a note in the email as to where the attachment is saved:

‘Declarations
Dim sDir As String
Dim s As NotesSession
Dim w As NotesUIWorkspace
Dim db As NotesDatabase
Dim dc As NotesDocumentCollection
Dim doc As NotesDocument

‘Initialize
Sub Initialize
Set s = New NotesSession
Set w = New NotesUIWorkspace
Set db = s.CurrentDatabase
Set dc = db.UnprocessedDocuments
Set doc = dc.GetFirstDocument
Dim rtItem As NotesRichTextItem
Dim RTNames List As String
Dim DOCNames List As String
Dim itemCount As Integer
Dim sDefaultFolder As String
Dim x As Integer
Dim vtDir As Variant
Dim iCount As Integer
Dim j As Integer
Dim lngExportedCount As Long
Dim attachmentObject As Variant

x = Msgbox(“This action will extract all attachments from the ” & Cstr(dc.Count) & _
” document(s) you have selected, and place them into the folder of your choice.” & _
Chr(10) & Chr(10) & “Would you like to continue?”, 32 + 4, “Export Attachments”)
If x <> 6 Then Exit Sub

sDefaultFolder = s.GetEnvironmentString(“LPP_ExportAttachments_DefaultFolder”)
If sDefaultFolder = “” Then sDefaultFolder = “C:”
vtDir = w.SaveFileDialog( False, “Export attachments to which folder?”, “All files|*.*”, sDefaultFolder, “Choose Folder and Click Save”)
If Isempty(vtDir) Then Exit Sub
sDir = Strleftback(vtDir(0), “”)
Call s.SetEnvironmentVar(“LPP_ExportAttachments_DefaultFolder”, sDir)

While Not (doc Is Nothing)

iCount = 0
itemCount = 0
lngExportedCount = 0
Erase RTNames
Erase DocNames

‘Scan all items in document
Forall i In doc.Items

If i.Type = RICHTEXT Then
Set rtItem = doc.GetfirstItem(i.Name)
If Not Isempty(rtItem.EmbeddedObjects) Then
RTNames(itemCount) = Cstr(i.Name)
itemCount = itemCount +1
End If
End If

End Forall

For j = 0 To itemCount-1
Set rtItem = Nothing
Set rtItem = doc.GetfirstItem(RTNames(j))
Forall Obj In rtItem.EmbeddedObjects
If ( Obj.Type = EMBED_ATTACHMENT ) Then
Call ExportAttachment(Obj)
Call rtItem.AppendText(“Embedded objects…attachments, pictures, etc. stored at: ” & sDir & Chr(13))
Call Obj.Remove
Call doc.Save( False, True ) ‘creates conflict doc if conflict exists
End If
End Forall
Next

‘Scan all items in document
Forall i In doc.Items

If i.Type = ATTACHMENT Then

DOCNames(lngExportedCount) = i.Values(0)
lngExportedCount = lngExportedCount + 1

End If

End Forall

For j% = 0 To lngExportedCount-1
Set attachmentObject = Nothing
Set attachmentObject = doc.GetAttachment(DOCNames(j%))
Call ExportAttachment(attachmentObject)
Call attachmentObject.Remove
Call doc.Save( False, True ) ‘creates conflict doc if conflict exists
Next

Set doc = dc.GetNextDocument(doc)
Wend

Msgbox “Export Complete.”, 16, “Finished”
End Sub

‘ExportAttachment
Sub ExportAttachment(o As Variant)
Dim sAttachmentName As String
Dim sNum As String
Dim sTemp As String

sAttachmentName = sDir & “” & o.Source
While Not (Dir$(sAttachmentName, 0) = “”)
sNum = Right(Strleftback(sAttachmentName, “.”), 2)
If Isnumeric(sNum) Then
sTemp = Strleftback(sAttachmentName, “.”)
sTemp = Left(sTemp, Len(sTemp) – 2)
sAttachmentName = sTemp & Format$(Cint(sNum) + 1, “##00″) & _
“.” & Strrightback(sAttachmentName, “.”)
Else
sAttachmentName = Strleftback(sAttachmentName, “.”) & _
“01.” & Strrightback sAttachmentName, “.”)
End If
Wend

Print “Exporting ” & sAttachmentName
‘Save the file
Call o.ExtractFile( sAttachmentName )
End Sub

Discuss This Question: 3  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Ivan8r
    This would be the first time that I do any scripting for Lotus Notes. Do I need a separate program to do coding, or is there a built-in scripting module within Lotus Notes 6.5.3?
    0 pointsBadges:
    report
  • Djakelic
    Check out this 3rd party tool that lets you export Lotus Notes emails into PDF archives: http://www.swingsoftware.com/pdf-converter/overview It supports Lotus Notes 6.5 (or later) and doesn't require any programming skills. Once it has been installed as a toolbar icon in Lotus Notes, you can export selected emails (as a single PDF file or as separate PDF files) with attachments. Hope this helps.
    120 pointsBadges:
    report
  • Djakelic
    Oops... here is the link: http://www.swingsoftware.com/pdf-converter/overview
    120 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following