Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automate detachment of files on a schedule...how? 1

Status
Not open for further replies.

Klopper

MIS
Dec 7, 2000
84
US
Hi

I receive via email a number of batch reports as attachments (normally Microsoft Excel file) each day. If we are using Notes R5, what do I have to do so that, at a scheduled time each day, my email folders are scanned and specifc attachments are detached and saved down to a folder.

I have zero Lotus skills....
I am hoping someone can advise what tools (Agents, or LotusScript maybe ?) and privileges are needed.

Thanks
Klopper
 
Hi,
I think there is no way how to do this with zero skills. But the solve of this problem could be so:

1. You can modify your Mail database design and add a new Notes Agent in.
2. You have to write a code in Lotus Script or Java that scans your mail and make detach action.
3. Schedule your agent to run on server (or set it as Run when new mail arrives).

To get this working, you have to have privileges to run Notes Agents on your mail server. It is good also to talk to your Domino admin because server could be set to refresh database designs via its templates. This could remove all changes that you make to your mail database's design.

I hope this will help you to make idea how is it working.

by Mortan


 
Thanks for the suggestions Mortan, Richie.

Richiem, I have some VBA skills but not much COM / OLE so bear with me:
Your suggested code looks perfect! I am using Access or Excel 97 and Notes R5; I cannot see the Domino reference, so coudl you advise where I can download the required .tlb file or how I should modify the code to suit.

Many thanks, please feel free to barrage me with Access / Excel Q's..
Klopper
 
That code should works with VBA too. The domobj.tlb file should be located in Lotus\notes directory.
The code could be use with notes 4.x and 5.x, there is separate stuff for each one (you could use just one for both but i prefer to show OLE way AND COM way.
 
Ok I have found and selected domobj.tlb!
But this line of code:
Set View = odb.GetView("($Inbox)")
give me a "variable not defined" error

what is odb? and how is it set?
 
Got your spreadsheet Richie, but get same problem:
"Run-time error 91, Object variable or With block variable not set."

I think the is the Domino.NotesSession and Domino.NotesDatabase variable are not set in the code and I am not sure hwo to do this.

I only have Notes R5 installed, I am wondering it Designer is needed as well.


 
Got your spreadsheet Richie, but get same problem:
"Run-time error 91, Object variable or With block variable not set."

I think the is the Domino.NotesSession and Domino.NotesDatabase variable are not set in the code and I am not sure hwo to do this.

I only have Notes R5 installed, I am wondering if Designer is needed as well.


 
I have Lotus 5 installed too and code works fine.
You have to call procedures in this way:

OpenSess
NotesSaveAttachs
NotesCloseSession
 
Good point Richie!

I am now getting error 429 (ActiveX component cannot be created) which apparently could be related to the windows registry, ocx's and dlls or my workstation admin rights... all a bit beyond me and I'm afraid I am losing the will to carry on... :-(

Are you aware of any other components that need to be installed?

The weird thing is, I am able to use the code below to send emails using Notes from VBA code with no problems. This code uses late binding and requires knowledge of LotusScript. I found it here on Tek-tips.

CODE:
Public Sub EmailWithNotes(strSendTo As String, strSubject As String, Optional strCCTo As String, _
Optional strBody As String, Optional strAttachPath As String)

Dim objSession As Object
Dim objDB As Object
Dim objDoc As Object
Dim objAttach As Object
Dim objEmbed As Object
On Error GoTo err_EmailWithNotes
' -Creates a Lotus Notes Session if there isn't one already running
Set objSession = CreateObject("Notes.NotesSession")
' -Set db to a database not yet named
Set objDB = objSession.GetDatabase("", "")
' -Sets database to default mail database
Call objDB.OPENMAIL
' -Creates a new mail document
Set objDoc = objDB.CREATEDOCUMENT
' -Insert passed variables into mail document.
Call objDoc.REPLACEITEMVALUE("SendTo", strSendTo)
Call objDoc.REPLACEITEMVALUE("Subject", strSubject)

etc etc.
 
OK. In that code, a session is instantiated so there would be another problem with the code that i gave you.
It is not LotusScript as long as i know (but maybe i am wrong)
Believe me, i use that code all the time without problems.
(indeed, it is automated and doesn't requires end user intervention and code works since i have the attachs in the folder that i assigned to it)
In which line do you get the error?
 
The error is first line of OpenSess routine:

Set COMSess = New Domino.NotesSession


 
Two things:
1) Open VB editor (Alt+F11) and go to Tools, references.. menu.
In the dialog, look up for a MISSING text in the list near Domino library
If so, look at examine... button and locate the domobj.tlb file.
Could you send me a screen capture of the list?

or
2) Are you sure that you are using Lotus 5?


 
Definitely Notes Release 5.08 and I have Lotus Domino Object set to the domobj.tlb file.

I wonder if has something to do with my registered ActiveX components..how do I find out which Lotus / Domino are required?

Your patience and help is much appreciated.
 
OK, I have working - it was a case of RTFM! :)

The Helpfile at the link below gives instructions about how to register the required Domino ActiveX component.
In this case, go to the DOS command prompt and change directory to C:\Program Files\Notes then type "regsvr32 nlsxbe.dll".

Thanks for the help Richie, have a star.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top