Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

read mail from lotus domino 1

Status
Not open for further replies.

nigelrivett

IS-IT--Management
Sep 8, 2003
1,774
GB
I have a requirement to get attachments from a mail account into a disk folder. I suspect the obvious way to do this would be to write an agent? But we don't have easy access to server development.
I seem to be able to connect to the server (I think) but not to the mail database.
In vb

Set o = CreateObject("lotus.NotesSession")
Call o.Initialize
MailServer = o.GETENVIRONMENTSTRING("MailServer", True)
Set dir = o.GETDBDIRECTORY(MailServer)
Set db = dir.GETFIRSTDATABASE(1247)

The GETFIRSTDATABASE fails with directory xxxxxx does not exist.

Is this something I am doing wrong or something that's not possible. I suspect I shouldn't have permission to do this but thought I would try.

======================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
 
If you have access to the specific mailbox, it is quite possible to extract attachments to a directory under certain conditions.

You do not need to iterate through the mailboxes to reach a specific mail database. That endevour is fruitless anyway since you certainly do not have authorization to read every mailbox.

You need to start by requesting permission from the owner of the db to access his mailbox. Once this is technically established in the database ACL, you can then use the getDatabase method of the Notessession to retrieve the mailbox you need.

After that, you'll need to get the AllDocuments view and iterate through that to find attachments and detach them to a folder.

You need to be aware of two things :

1) if you need to extract the attachments to a local folder, you will have to run the agent in your client and that will take an impressive amount of time over the network as mailboxes are not generally empty and everything is embedded in Notes network protocol (not the fastest of the bunch by a long shot).

2) if you need speed and iteration over multiple mailboxes, this will have to be a scheduled agent and you will be detaching to a server-accessible drive somewhere on the network.

The two options are mutually exclusive. Either you detach to a local drive manually, or the server does the job on a network drive much faster. Your choice.

Pascal.


I've got nothing to hide, and I'd very much like to keep that away from prying eyes.
 
Thanks - looks like I'm in the right place.

The problem is that the server maintanance is outsourced and takes a long time to get anything done. If we were to request changes we would ask them to deliver the attachments to a directory which looks like it is pretty simple from the server.

The reason for this is that we need to receive data from an outside client on a daily basis - just a few hundred rows. It's 2 moinths lead time to give them VPN) preferred or FTP access and they don't want us to pick it up from them. The solution given is to email it.
Performance (hopefully) isn't a problem as the mail account will be set up specifically for this and these emails will be all that is in the mailbox.

It looks like we have control of a documents database but have no way of getting the email attachment into that.

Maybe the people here who administer the desktops can give me admin access to an email database.
Pretty sure option 2) is out of the question. Suspect option 1) is similar to what I am attempting via VB.

======================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
 
I'm just testing this before going further
We have a document folder of which I am manager. I'm guessing this isn't enough to enable me to open the database and I need to have Full Access Administrator?

When I try to open the database (I assume that is the .nsf file?) the isopen gives false.

If that's the case I'll see if I can be given admin rights on a database.

======================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
 
Can't get an isopen = true.
The said they had made me admin of my mail database but when I look at the effective access for me in notes everything is checked except Full Access Administrator, my access is designer.

Is this the problem?

The other thing I am not sure abot is the server name and database name.
Should the database name include the .nsf at the end?
It is of the form mail\myname.nsf

When I get the server string it has
CN=XXNotesMail01/OU=place/O=company name

I've tried with the keywords and without - doesn't make a difference.
On the mail database the server is XXNDMail01/place/company name

Odd that the server name is different from that in the session environment string?
Still doesn't work with that as the server name.

======================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
 
If you have anything at Reader or above, you have access. However, yes : the database name always ends with nsf - you have to add that if it is missing.

That is probably why you don't get the True value for isopen.

Pascal.


I've got nothing to hide, and I'd very much like to keep that away from prying eyes.
 
Dang. Sounds like this shouild be feasible then.
I did try it with various combinations of database name and server name and got no result for any.

I'll try restarting my machine just in case something has got screwed.

Do you know what the server name should be?
When I look at the environment string on the session I get
CN=XXNotesMail01/OU=place/O=company name
so I tried
XXNotesMail01/place/company name

When I look at the database properties in lotus notes it is
XXNDMail01/place/company name
I suspect that is the correct server name but is the server name in the session I created causing a problem?

Thanks for your help.
I thought this wouldn't be possible.
At some point after the proof of concept I will have to present what I am doing which could be a big problem.

======================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
 
Think I've answered the server one. I was getting the mail server name but the database resides on XXNDMail01/place/company name.


======================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
 
Still can't get anywhere
Here's the code

Dim session As Object
Dim MailServer As String
Dim db As Object
Set session = CreateObject("lotus.NotesSession")
Call session.Initialize
MailServer = session.GetEnvironmentString("MailServer", True)
Set db = session.GetDatabase("XXNDMail01/XXXXXXX/XXX Xxxxxxxx Xxxxxxxx", "mail\NRivett.nsf")
MsgBox db.IsOpen

gives false.
Mailserver is populated so we are initializing a session.
When I browse for a database in lotus notes it looks like the server name is correct.
Under that there is mail and under that Nigel Rivett with filesname mail\NRivett.nsf
That fails to open in VB.

Any idea what the problem could be or suggestions as to what I could try?

======================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
 
Maybe there is a problem in your approach. This is how I would write it in LotusScript :
Code:
dim session as New Notessession 'this opens the session already
dim db as notesDatabase
dim mailserver as string

set db = session.currentdatabase
mailserver = db.server
Of course, there is one major difference, the code would be running in a database on the server, so I am already in the proper environment, whereas you have to acquire the environment entirely.

Pascal.


I've got nothing to hide, and I'd very much like to keep that away from prying eyes.
 
I'm using late binding so that should be the same thing - not sure why you don't have to initialize the session. If I don't it gives an error that it's not initialized (hate the z). I think that I may be using a different object library as I'm on a client.

Think you have the lotus notes automation classes (no initialze on session) whereas I am using the lotus domino objects.

When I try the currentdatabase it says not implemented.
If I try to use the objects that you are the new works but it says not initialized when I try to access it.

I'm wondering if I'm really connecting to the domino server or to something local.

======================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
 
Looking at the registration for lotus notes automation classes it is pointing at the notes folder rather than the notes65 folder.
Might try changing that on Monday.

======================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
 
The session is initialized in the declaration, otherwise I would have to write :
Code:
dim session as Notessession
set session = New Notessession

I think you're close to the mark when you ask yourself what you're connecting to. You need to ensure that you do actually connect to the server. Unfortunately, I don't know enough about VB to help you.

The only thing I can say is that, in Notes, I can check what server I'm on via the database object. If the servername is empty, then I'm local.

Pascal.


I've got nothing to hide, and I'd very much like to keep that away from prying eyes.
 
I managed to get a database list using
Set dir = session.GetDbDirectory("")
Set db = dir.GetFirstDatabase(1247)
Do While Not (db Is Nothing)
Debug.Print db.Title, , db.FilePath
Set db = dir.GetNextDatabase
Loop


Favorites favorite.nsf
Journal journal.nsf
Notes Log () log.nsf
Lancaster's Address Book names.nsf
Personal Web Navigator perweb.nsf

Interestingly Lancaster is the person who had this desktop before me. I have a suspicion she installed a domino server on this desktop which is messing things up.
I can't connect to anything else - if I try to give a user name it fails.

======================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
 
A Domino server locally ? Not listed in the active server list ? Yikes !

I would suggest backing up your databases and totally erasing all traces of Notes - client or server - before reinstalling a proper Notes and Designer client.

You cannot expect to properly develop if you don't what you're working with.

Pascal.


I've got nothing to hide, and I'd very much like to keep that away from prying eyes.
 
>> You cannot expect to properly develop if you don't what you're working with.

Don't really have the option here. It's not meant to be an IT department.

I did try to go for a reinstall of notes but there would be a 10 day lead time for it.
Think I should go for a rebuild of the machine but I'm worried about losing local admin access to it.

======================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
 
Arrgghh ! I should've wrote "if you don't know what you're working with". Sorry.

If you cannot get a reinstall of Notes, you should at least be able to de-install the server. The installation should be different.

Pascal.


I've got nothing to hide, and I'd very much like to keep that away from prying eyes.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top