Solved

Controlling LN email with VBA

Posted on 2012-03-30
7
666 Views
Last Modified: 2013-12-18
I've got an MS Access DB that sends and tracks LN emails.   Right now it works only by sending emails from my account, i.e., the one associated with my LN client login on my machine.

I would like to do these functions using a group mail box for which I have admin rights.

So the question is how to redirect (and or control the) access to another Lotus Notes inbox via VBA...

Testing the process of checking the inbox, and even with a hard coded .NSF file and server, it still points to default inbox.
=====================================================================================================
This is the current code which looks at the users inbox: Need the ability to point to a different inbox

Set mSession = CreateObject("Notes.NotesSession")
UserName = mSession.UserName
MailDbName = Left$(UserName, 1) & Right(UserName, (Len(UserName) - InStr(1, UserName, " "))) & ".nsf"
Set Maildb = mSession.GETDATABASE("", MailDbName)

Maildb.OPENMAIL
Set NotesDocs = Maildb.GETVIEW("($Inbox)")
Set MailDoc = NotesDocs.GETLASTDOCUMENT

Any help with this would be appreciated.

Thanks!
0
Comment
Question by:codequest
  • 3
  • 2
7 Comments
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 37788293
Instead of
UserName = mSession.UserName
MailDbName = Left$(UserName, 1) & Right(UserName, (Len(UserName) - InStr(1, UserName, " "))) & ".nsf"

Open in new window

use a fixed name like
MailDbName= "thegroupmaildb.nsf"

Open in new window

0
 

Expert Comment

by:jwtchdev
ID: 37798548
Tried this solution with the same results. Resolved w/approach: Instead of separate db-Created a sub folder, and added a rule to post incoming emails to new folder, then parsed folder
0
 
LVL 2

Author Comment

by:codequest
ID: 37799044
sjef_bosman:  thanks for input

jwtchdev and I discussed this offline; I accept his solution.
0
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 37799806
Not really "correct", now is it? Next time you take a discussion off-line, be open about it. Anyway, it's against EE-rules (!) but in some cases it can't be avoided.

At least you owe us the outcome of the discussion, can you present it here?
0
 
LVL 2

Accepted Solution

by:
codequest earned 0 total points
ID: 37803901
We talked because we're co-workers...he got to the answer first.  We thought we had explained it above.

Colleague said he tried your hardcoding solution, and it didn't work.  Also, he could not find a reference to another DB through internet research.   So...

1)  Instead of attempting to use, access or manipulate separate db
2)  Manually created a sub folder
3)  Manually added a rule to post incoming emails to new folder
4)  Then, in code, instead of looking for a separate db, parsed the sub-folder structure using this code:

Set MailDoc = NotesDocs.GETLASTDOCUMENT

     While Not (MailDoc Is Nothing)
     '*******************************
     'Do
       aItems = CVar(MailDoc.Items)
       For iThisItem = 0 To UBound(aItems)
           Set NI = aItems(iThisItem)
            If NI.Name = "$File" Then
            aValues = CVar(NI.Values)
            wFrom = MailDoc.GetFirstItem("From").Text
            Set EO = MailDoc.GetAttachment(aValues(0))

            EO.ExtractFile "C:TargetDir\" & aValues(0)
            End If
       Next iThisItem

           Set MailDoc = NotesDocs.GETPREVDOCUMENT(MailDoc)

     Wend

Hope that helps.  

If you would like to try again, in terms of using a separate DB, I'll post another question about trying to get it done with a separate db.   Maybe there is another object in VBA for Lotus that is not the current session?
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 37804047
I don't really understand, but if it works for you, no problem.

There seems to be a misunderstanding, maybe even mine: you talked about "using a group mail box", from that I understood that you share one database with multiple people, and that database has a fixed name, which is why I suggested not to use the user's name to fetch the mail database name but to use a fixed name. As I said, there's no problem when it works for you :-)
0

Featured Post

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Ms Access VBA Variables 6 26
Modal form 11 30
Create macro from runcode 30 25
Criteria for Date for DCount 4 19
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
For beginners of Lotus Notes user this is important to know about the types of files and their location supported by IBM Notes. Mostly users are unaware about how many file types are created and what their usages are. This Article is fully dedicated…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

776 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