Solved

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

Posted on 2004-09-02
17
254 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Lotus Notes 8.0 Forward emails for 30 days. 8 94
How to Open Lotus Notes:// links in web browser 3 1,410
Text over two lines in VBA for email 26 159
Username format for Domino LDAP 3 81
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
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…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

895 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

13 Experts available now in Live!

Get 1:1 Help Now