Problem solve Get help with specific problems with your technologies, process and projects.

Automatically attach 700 documents in database

I have a domino database in which all docs will be deleted. I need to create new docs and on each document attach either a word or excel document. There are a total of 700 word/excel docs that will have to be attached, therefore 700 notes documents that will have to be created. How can I automatically do this?

This code is NOT complete... It is mostly functional, but it is meant to demonstrate how you could complete the task you are attempting. You will have to fill in some blanks yourself.

First, use the method in the following example to build an array of filenames for your program...

Dim pathName1, pathName2, fileName1, fileName2 As String
PathName1 = "c:\*.xls"
FileName1 = Dir$(pathName1, 0)
PathName2 = "c:\*.doc"
FileName2 = Dir$(pathName2, 0)
Dim counter as integer
Do While fileName1 <> ""
   Redim preserve fileList1(counter)
   FileList1(counter) = FileName1
   FileName1 = Dir$()
'Repeat for FileName2...
   Counter = counter + 1

Dim thisNotesDB as NotesDatabase 'Set it with NotesSession, etc...

For k = 0 to ubound(FileName1)
Dim newDoc as New NotesDocument(thisNotesDB)
Dim object as NotesEmbeddedObject
Dim item as NotesRichTextItem
Set item = new NotesRichTextItem( newDoc, "body" )
Set object = item.EmbedObject( EMBED_ATTACHMENT, "", filename1(k))
Call newDoc.save( false, false )
Next k

Dig Deeper on Lotus Notes Domino Administration Tools

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.




  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...