Solved

Controlling LN email with VBA

Posted on 2012-03-30
7
667 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
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 
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

IBM Notes offer Encryption feature using which the user can secure its NSF emails or entire database easily. In this section we will discuss about the process to Encrypt Incoming and Outgoing Mails in depth.
Notes Document Link used by IBM Notes is a link file which aids in the sharing of links to documents in email and webpages. The posts describe the importance and steps to create a Lotus Notes NDL file in brief.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

808 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