I would like to automatically upload files from my local or shared drive to a LN database (teamroom) document.How can I do that ?
Subject: Simply use a scheduled agent
Hello. This can simply be accomplished by using a scheduled LotusScript agent that reads from the file system. The agent should use the Open statement to read the contents of the file you are interested in and cycle through each row of the file. There is an excellent example of using Open in the Lotus Domino Designer Help. Obviously, you would want to create a new database object so you can take the contents of the file and write it to a new document. Please be aware that the agent will need unrestricted agent access in the Notes server document it is running on if your scheduled agent is not running in a local database.
Subject: attachment
Hi Dave,
thank you for your feedback. However, I do not want the content of the e.g. Word or XLS file, but just to add it in to the database as an attachment.
Subject: Clarification
Oh, Ok. Sure that is even easier. I wasn’t sure from your original post whether you want to read the contents of a file to put into a document but you have clarified that you want to attach those files. First, just simply declare a new database object for the database that you want to attach your files in your LotusScript code. Then create a document in that database or get handle to an existing document. Once you get your document object set then simply get a handle to a rich text item or create a rich text item depending on whether it is an existing saved document or a new document. Then use the EmbedObject method to create an attachment in the new field. Lastly, remember to save the document.
so a snippet of code from the agent if creating a new document might look like:
'Create the new doc
Set doc = New NotesDocument(mydb)
'get a handle to a new rich text item RTBody
Set rtitem = New NotesRichTextItem( doc, “RTBody” )
'attach your file from the drive
Set object = rtitem.EmbedObject _
( EMBED_ATTACHMENT, “”, “c:\filetoattach.txt”)
Subject: thanks !
Hi Dave, thanks for your explanation and piece of code. Although I’m a novice on Lotusscript, I think I can use your example as a starting point.