Solved

Controlling LN email with VBA

Posted on 2012-03-30
7
664 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
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 
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

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

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…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

912 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

22 Experts available now in Live!

Get 1:1 Help Now