Q

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
Loop

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

This was first published in December 2001

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.

0 comments

Oldest 

Forgot Password?

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

Your password has been sent to:

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • 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 ...

SearchEnterpriseLinux

SearchDataCenter

SearchExchange

SearchContentManagement

Close