Solved

Controlling LN email with VBA

Posted on 2012-03-30
7
669 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

726 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