Solved

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

Posted on 2004-09-02
17
257 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This is an old article, please see an updated version of this article, located here: http://www.experts-exchange.com/articles/23619/Notes-8-5x-Windows-7-Notes-info-and-tips.html
  In today’s Arena we can’t imagine our lives without Internet as we are highly used to of it. If we consider our life style just for only 2 min we found that face to face communication is swapped by e-communication.  Every Where from Works place to…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

685 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