Solved

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

Posted on 2004-09-02
17
256 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
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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.

 
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
 

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

Problem "Can you help me recover my changes?  I double-clicked the attachment, made changes, and then hit Save before closing it.  But when I try to re-open it, my changes are missing!"    Solution This solution opens the Outlook Secure Temp Fold…
Lack of Storage capacity is a common problem that exists in every field of life. Here we are taking the case of Lotus Notes Emails, as we all know that we are totally depend on e-communication i.e. Emails. This article is fully dedicated to resolvin…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
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…

808 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