Created
December 14, 2021 18:18
-
-
Save kucerarichard/eb1f2ca945d6e971c7647cb8a64d2ccb to your computer and use it in GitHub Desktop.
How to export your crap from Lotus Notes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub Initialize | |
Dim arrAttachmentNames As Variant | |
Dim session As New NotesSession | |
Dim db As NotesDatabase | |
Dim dc As NotesDocumentCollection | |
Dim doc As NotesDocument | |
Dim attachment As NotesEmbeddedObject | |
Set db = session.CurrentDatabase | |
Set dc = db.AllDocuments | |
Set doc = dc.GetFirstDocument | |
CurrID = 100000 | |
While Not doc Is Nothing | |
CurrIDStr = CurrID | |
Open "d:/export/records/"+CurrIDStr+".xml" For Output As 1 | |
Print #1, "" | |
Print #1, ""+CurrIDStr+"" | |
arrAttachmentNames = Evaluate("@AttachmentNames", doc) | |
For n = 0 To Ubound( arrAttachmentNames ) | |
If arrAttachmentNames(n) Like "*.*" Then | |
Set attachment = doc.GetAttachment( | |
arrAttachmentNames(n) ) | |
fileName=CurrIDStr+"-"+arrAttachmentNames(n) | |
Print #1,""+fileName+"" | |
Call | |
attachment.ExtractFile("d:/export/attachments/"+fileName) | |
End If | |
Next n | |
allFieldNames = Evaluate("@DocFields", doc) | |
For k = 0 To Ubound( allFieldNames ) | |
Print #1, "" | |
Print #1, "" | |
Print #1, allFieldNames(k) | |
Print #1, "" | |
Print #1, "" | |
If Not Isempty(doc.GetItemValue(allFieldNames(k))) Then | |
something = doc.GetItemValue(allFieldNames(k))(0) | |
Print #1, something | |
End If | |
Print #1, "" | |
Print #1, "" | |
Next k | |
Print #1, "" | |
Close #1 | |
Set doc = dc.GetNextDocument( doc ) | |
CurrID = CurrID + 1 | |
Wend | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment