Solved

Lotus 6, how do I set up a document to automatically upload an attachment from a folder?

Posted on 2004-09-02
17
251 Views
Last Modified: 2013-12-18
I haven't created the form yet but can anyone give me the steps and code?  I want to run an agent every 8 hours to upload create a document and attach an attachment.  
0
Comment
Question by:sjmmajor
  • 8
  • 7
17 Comments
 
LVL 19

Expert Comment

by:madheeswar
ID: 11970427
u should maintain a log to monitor if the agent has run in last 8 hours.
And maintain a Static folder to attach and place the path of the folder in the agent.
and also, how many files will be placed in that folder?

thanks
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 11970853
Madheeswar, this must a job for your company Rent-A-Coder Inc. at 500 points :) You must have the exact example in your toolbox somewhere. Btw, I think Sjmmajor is not talking about Notes folders, but a directory on disk.

What my approach would be: create an agent that runs every hour but only uploads every 8 hours. It will use a profile document to store the current time and the time it last performed an upload. If more than 8 (or 7.5) hours passed since, the actual upload will take place. The uploading and attaching is not very difficult, see the EmbedObject method in the NotesRichTextItem class.
0
 

Author Comment

by:sjmmajor
ID: 11971891
sjef bosman you are right.  I want it to come from a directory on disk.  I see the code but where does this code reside, in the Agent?
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 11972277
In an agent, yes, to be called from the Initialize event. What is it that you want to do exactly, always the same file, to always the same document or each time a new one? What are your spec's?
0
 

Author Comment

by:sjmmajor
ID: 11972940
I am getting action failed.  Query is not understandable.  Here is the code I used in my agent.

                Dim session As New NotesSession
      Dim db As NotesDatabase
      Dim rtitem As NotesRichTextItem
      Dim object As NotesEmbeddedObject
      Set db = session.CurrentDatabase
      Set doc = New NotesDocument (db)
      Set rtitem = New NotesRichTextItem (doc,"Body")
      Set object = rtitem.EmbeddedObjects(EMBED_ATTACHMENT,"", "C:\jobchanges\testdoc.XLS")
      DOC.FORM = "Main Topic"
      doc.Subject = "Here is the test document"
      Call doc.save(True,True)
I think this one creates the field in the document.  I just would like to update the field in the document.
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 11973012
Very near!

Set object = rtitem.EmbeddedObjects(EMBED_ATTACHMENT,"", "C:\jobchanges\testdoc.XLS")

There is EmbeddedObjects, but you have to use EmbedObject

Sjef :)
0
 

Author Comment

by:sjmmajor
ID: 11973086
I am still getting the same error. Is there something else on the agent that I should be doing?  I appreciate your help!
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 11973127
You know that you can run an agent manually, from the LotusScript Debugger? Did you define EMBED_ATTACHMENT, or include the file lsconst.lss?
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:sjmmajor
ID: 11973830
Where would I define Embed_attachment?  I did turn on the debugger and I ran the agent manually in the view but the agent didn't show me line by line like I would think a debugger would.  It still showed the same error message at the bottom.

I know I must be missing something.  Is there something I have to do in the form?

0
 
LVL 46

Accepted Solution

by:
Sjef Bosman earned 500 total points
ID: 11974062
You can do three things to make it work:
- use plain 1454
- define EMBED_ATTACHMENT as
    Const EMBED_ATTACHMENT= 1454
- use an include in the options or declarations section:
    %include "LSCONST.LSS"

That is, if that's the error. Did you set, in the Options section:
    Option Declare
This will ensure that you have to declare EVERY global variable. In R6 you can set this as default setting. What happens if you didn't set it: EMBED_ATTACHMENT will have the value 0!

To use stepping in the Debugger, either click on Step Into all the time, or use F8.
0
 

Author Comment

by:sjmmajor
ID: 11975803
I must be brain dead today.  Do I define that in the form or the agent?
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 11976469
There is no form involved, unless I'm terribly mistaken. The only form you might need is to open the document that the agent created. If that's what is supposed to be happening. For the time being, just replace EMBED_ATTACHMENT by 1454 and see if it works. Polishing up comes later.
0
 

Author Comment

by:sjmmajor
ID: 11976561
I finally got that part.  Wow!  Now it is giving me the error "Unexpected: Const, Expected: Data Type New"

It does create the document and I can open it but it gives me that error while opening it.

0
 

Author Comment

by:sjmmajor
ID: 11976730
I got it!!  But for some reason it doesn't open an HTM file.  It will for a regular excel file.  I can open another question for the points.  

You have been a big help!  
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 11979480
I wouldn't know if an HTM file were treated differently from any other file. Seems a bit odd to me. Try again, with a fixed named file in a known directory, first as filename.txt, then as filename.htm.
0
 

Author Comment

by:sjmmajor
ID: 12707329
Sorry I thought I had closed this out.  Thanks sjef bosman for all your help!! It is working great!!
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

For Desktop Techs: How to retain a user's Notes configuration data when swapping out the end user's computer. (Assuming that you are not upgrading to a completely different version of Notes client) All you need to do is: 1) install Notes o…
For users on the Lotus Notes 8 Standard client, this article provides information on checking the Java Heap size and adjusting it to half of your system RAM in attempt to get the Lotus Notes 8.x Standard client to run faster.  I've had to exercise t…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

744 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now