Solved

How to export attachments in bulk from a Lotus database?

Posted on 2008-10-29
4
5,154 Views
Last Modified: 2013-12-18
Switching from a Lotus based contact manager, to Salesforce and need to be able to export fields with attachments and have those attachments be preserved so that they can be imported into Salesforce.

Are there any tools that can do this?  Have tried the NotesSQL 8.0 ODBC Drivers and can't seem to isolate the attachments.
0
Comment
Question by:WrecklessOne
4 Comments
 
LVL 63

Expert Comment

by:SysExpert
ID: 22835099
0
 
LVL 3

Expert Comment

by:rd153
ID: 22937842
It should be fairly simple to write something in LotusScript which would do this
0
 
LVL 5

Accepted Solution

by:
mekhet30 earned 250 total points
ID: 22947881
You can create an agent in the database that will do this for you.

Here is code that I have used before:

What you need to do is create a view in the db that has all the documents sorted by first column and you need the name of the field that contains the attachments

View e.g. AllDocumentsByForm
Field e.g. attachments

Sub Initialize
Dim session As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim nextdoc as notesdocument
Dim dirpath As String
Dim view As NotesView
Dim fullpath As String
      
Set db = session.CurrentDatabase
Set view = db.GetView("AllDocumentsByForm")
Set doc = view.GetFirstDocument

 Dim num As Integer
 dirpath = "c:\Images"
 If (Dir$ (dirpath, 16) = "") Then
  Mkdir dirpath
End If

While not doc is nothing
set nextdoc = view.getnextdocument(db)
            
 '-- Loop through all attachments in document and detach to Notes Data Directory
      Dim rtitem As Variant    
      Set rtitem = doc.GetFirstItem( "attachments" )
                  
'-- if array of embedded objects exist then detach all attachments into the Notes Data directory
      If Isarray( rtitem.EmbeddedObjects ) Then
            Forall o In rtitem.EmbeddedObjects
                  If ( o.Type = EMBED_ATTACHMENT ) Then
                        fullpath = dirpath & "\" & o.source                        
                                    
                        Call o.ExtractFile( fullpath )    
                                    
                  End If
            End Forall
        end if

set doc = nextdoc
Wend
End Sub


NOTE:  If any attachments have the same name, then they will be overwritten.  The code can be adjusted to avoid this

Cheers
0
 

Author Comment

by:WrecklessOne
ID: 23122602
The solution ended up being a manual one, since we needed to ensure that each attachment, not only maintained it's original name, but that when brought into the new system the proper relationship between the attachment and the document is was being attached to was also maintained.

Thanks all!

Georges
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I thought it will be a good idea to make a post as it will help in case someone else faces these issues. I trust this gives an idea how each entry in Notes.ini can mean a lot for the Domino Server to be functioning properly. This article discusses t…
For beginners of Lotus Notes user this is important to know about the types of files and their location supported by IBM Notes. Mostly users are unaware about how many file types are created and what their usages are. This Article is fully dedicated…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question