This forum is closed to new posts and responses. New discussions are now taking place in the IBM Developer Answers forum.

Jan 25, 2017, 6:39 AM
2 Posts

Lotus Notes 9 SE saving attachments into folder

  • Category: Notes Client
  • Platform: Windows
  • Release: 9.0.1
  • Role: End User
  • Tags:
  • Replies: 4


I'm using at work Lotus Notes 9.0.1 application as mail client. I'm facing with the problem that I would like to save automatically attachments, which I recieve. I receive plenty of email and I wonder how to do save the attachements into different folders depend of the subject or email addres.

Is it possible to do this in Lotus? I need something extra?




Jan 25, 2017, 9:32 AM
362 Posts
Y'need someone who knows BASIC.

Honestly, when Notes was initially released it was intended to give users a long, useful, practical curve to help automate their work. Yep, the idea was to let users personalize it all. It was a tall order though. OTOH a lot of the features work awfully well to get you there.

With Standard Edition (and in fact Basic Edition too) you have the ability to create a program -- called an "agent" -- that runs locally on your workstation. It'd need to run on a schedule there. But it's not hard code to write.

In point of fact, as a developer I do the same thing, only in reverse. I attach files that've changed into Notes so that I've got backups for the day.

The objects for finding & extracting attachments are simpler to operate, if the sender were building a Notes mail. However, both systems have the ability to find & extract the data you're looking for, it's just more subtle to search for attachments outside the "mail content" field.

So, I'm telling you this "in theory". If you have no one on staff who can help you build such a small bit of code, I may find time to sketch it out for you. Unfortunately I also do this for a living. So it'd be a good time to get a buddy in your staff who is either great at programming things like Notes, or even Excel -- or if you want to take the initiative yourself, that's good too.

The Domino Designer Help has a pretty good tutorial that can get you (or someone else) started, too. The script will be checking "NotesDatabase.unprocessedDocuments", cycling through your mail, running across mail with attachments, then figuring out what to do with the attachment.

Jan 25, 2017, 3:08 PM
82 Posts
Dim rtitem
Set rtitem = doc.GetFirstItem( "Body" )

If ( rtitem.Type = RICHTEXT ) Then

       ForAll o In rtitem.EmbeddedObjects

               If ( o.Type = EMBED_ATTACHMENT ) Then

                       Call o.ExtractFile ( |c:\attachments\| & )

               End If

       End ForAll

End If
Jan 25, 2017, 9:50 AM
362 Posts
The rough outline.

When you create an agent, there're settings for how the agent runs. Set them to "on a schedule", and "multiple times a day". There's a button there, too. click the button and there's a "server to run this agent". Put an asterisk in that field. It'll change to "any server" when you hit ok.

You can run it more often than every hour, but let's start there. It'll have a huge backlog of everything in your email. (we can change that if your email is already at the thousands).

The "Initialize" section is where you want to put your code.

Below is some boiler plate to get you scanning through "new mail". It'll start you off with some very standard things for scanning a collection. I'm hopeful, but I may've misspelled a thing or two, since I'm just typing this stuff in & not running it through Designer. But ... give it a whirl:

Sub Initialize

dim sess as New NotesSession

dim db as NotesDatabase

dim coll as NotesDocumentCollection

dim doc as NotesDocument

dim eo as NotesEmbeddedObject

set db = sess.CurrentDatabase

'collect all the documents changed since the last scheduled run

set coll = db.UnprocessedDocuments

set doc = coll.GetFirstDocument

while not doc is nothing

'[[your extraction code will go here]]

sess.UpdateProcessedDoc doc

set doc = coll.GetNextDocument(doc)


exit sub

Jan 26, 2017, 5:46 AM
2 Posts
Lotus Notes 9 SE saving attachments into folder

Hello Mike,

At the begining thank you very much for your support and effort. Maybe I will explain a little bit more how work my company mailbox. I receive lot of email per day (about 100--150), about 60-70 of them have attachments, mostly in pdf or xls, which I would like to save directly to the specific folders. Also to this mailbox are attached other people from my team. In Lotus im a newbie, but I programming a lot in VBa, I'm not a specialist but I know how it works.

For example: I recieve 20 email from with subject with contains "Customised - CMOV_ALL001" with xls attachment and I would like to save it to folder CASH in dir "S:\CASH"

I have opened agent menu and added you code, I assume its not full and i have to add there something more? I would really like to learn how to do this.


Thanks again Mike


This forum is closed to new posts and responses. New discussions are now taking place in the IBM Developer Answers forum.