Solved

Controlling LN email with VBA

Posted on 2012-03-30
7
663 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
Comment Utility
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
Comment Utility
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
Comment Utility
sjef_bosman:  thanks for input

jwtchdev and I discussed this offline; I accept his solution.
0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 46

Expert Comment

by:Sjef Bosman
Comment Utility
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
Comment Utility
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
Comment Utility
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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

  In today’s Arena we can’t imagine our lives without Internet as we are highly used to of it. If we consider our life style just for only 2 min we found that face to face communication is swapped by e-communication.  Every Where from Works place to…
Problem "Can you help me recover my changes?  I double-clicked the attachment, made changes, and then hit Save before closing it.  But when I try to re-open it, my changes are missing!"    Solution This solution opens the Outlook Secure Temp Fold…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

743 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now