Solved

Load recipient List From Mail Server

Posted on 2003-12-01
19
518 Views
Last Modified: 2013-12-18
I would like to know how can I load the list of recipient from my Mail Server into a listbox using Visual Basic. I want to allow the user to be able to just select from the list instead of having to type in manually themselves.

I have tried sending and mail in Visual basic using Sendto "Jerah Teo". It seems to work that way. Initially I thought when sending mail it always have to use the internet email address format such as jerahteo@yahoo.com but it seem that in lotus notes its not necessary. I can just use Jerah Teo. Is my assumption correct ? Can can I use this method to send mail say

Sendto listbox.text

Please advise?
0
Comment
Question by:jerahteo
  • 8
  • 6
  • 5
19 Comments
 
LVL 31

Expert Comment

by:qwaletee
ID: 9854804
Your questino is a little bit confusing to me.  Are you asking how to load the "Address" dialog that apears when a user, in a Lotus Notes memo, presses the ADDRESS... button at the top?

I don't believe there is any exportable function you can call from VB without loading the Notes client.  if Notes is running, you can use the NotesUiWorkspace.PickListStrings method to display that dialog and get an aray of recipients returned.

You are also correct that when sending through Notes, you do not need to use the internet address format.  Notes natively uses the "Notes user ID" form, but also accepts many variants.  If it is unique, first name, last name, or even soundex of any name part will work.
0
 
LVL 19

Expert Comment

by:madheeswar
ID: 9854828
Qwaletee is correct in all aspects
0
 

Author Comment

by:jerahteo
ID: 9854877
I did come across some sample sometime ago but have lost the link. It did load the recipant list in VB without Lotus Notes application running.

My basic idea is to get the name list from the mail server. We have sister company all using lotus and therefore we have one share address book in the mail server. It is not possible to remember all the name therefore how can I load this the list of people from the address book located in the mail server.

Yes something like "Address" dialog that apears when a user, in a Lotus Notes memo.


0
 
LVL 19

Expert Comment

by:madheeswar
ID: 9854985
0
 

Author Comment

by:jerahteo
ID: 9855080
Perhaps madheeswar mistake me for writing scripts in Lotus. I am developing total stand alone vb in vb6 environment.
0
 
LVL 19

Expert Comment

by:madheeswar
ID: 9855095
I am in a hurry to post before Qwaletee.

So, while searching I got those two threads which will be help ful for u to look into.
The second link can have some tips which may halp u as well.

My answer is not on the spot. But, can help for the time being.

I am checking my database whether I have any links or code for ur requirement.

Wait for a while....
0
 
LVL 31

Expert Comment

by:qwaletee
ID: 9855235
I'm still not clear on what you are doing.  Where do you want data from? Are you looking for the complete list of users from the address book  i.e., a list of every possible e-Mail address?  Yes, you can retrieve that, but what I was pointing out is that you can't get the Lotus COM API to display a UI dialog, except as follows:

      Set ws = CreateObject("Notes.NotesUiWorkspace")
      result = ws.PickListStrings(0,True,"","","","Pick addresse(s)","Addressing",1)
      If Not Isarray(result) Then
            Print "non-array - cancel? " x
      Else
            For i = Lbound(result) To Ubound(result)
                  Print result(i)
            Next
      End If
0
 
LVL 31

Accepted Solution

by:
qwaletee earned 100 total points
ID: 9855394
But that does require the client to open.  If you wish to avoid having teh client open, you can run a loop that retrieves all names, but it will be really, really inefficient, unless you put in cahceing, lookahead, adn keysearch facilities similar to those found in teh dialog box displayed by the above code.  Here is a basic example:

      Const server = "your server name"
      Dim s As New NotesSession
      Dim directory As notesDatabase
      Set directory = s.getDatabase ( server , "names.nsf")
      Dim index As notesView
      Set index = directory.getView("People")
      Dim people As NotesViewNavigator
      Set people = index.CreateViewNav
      Dim entry As notesViewEntry
      Set entry = people.getFirst
      Print "Getting entries"
      Do Until entry Is Nothing
            Print "Address: " entry.columnvalues(1)
            Set entry = people.getNext(entry)
      Loop
0
 

Author Comment

by:jerahteo
ID: 9856006
May be let me explain again. I do not need the UI dialog. All I need is to go into the address book from the mail server and retrieve out the names and load it into the combo box in my vb application. So that the user do not need to type the name in the the Sendto field in my vb mail application. Just like going into the mail server to retrieve mail, I was wondering if there is any vb script which can be used to retrieve the names from the address book. I am looking for the complete list of users from the address book, a list of every possible e-Mail address.  

The first sample which you given is it for Lotus VB script or will it work for VB development script. Does the result here return a name from the address book.

     Set ws = CreateObject("Notes.NotesUiWorkspace")
     result = ws.PickListStrings(0,True,"","","","Pick addresse(s)","Addressing",1)
     If Not Isarray(result) Then
          Print "non-array - cancel? " x
     Else
          For i = Lbound(result) To Ubound(result)
               Print result(i)
          Next
     End If


0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:jerahteo
ID: 9856331
Anybody encounter this error before.
When the session.initialise was excuted I get this

Runtime Error !

Program C:\Program Files\Microsoft Visual Basic\VB98\VB6.exe

abnormal program termination
0
 
LVL 31

Expert Comment

by:qwaletee
ID: 9856337
Both examples should work in VB 6.0.  The SECOND retrieves the list of names from the address book without invoking any client code, and should work OK for a small environment.  The FIRST uses the Notes client's dialog box, which has built-in efficiencies.
0
 
LVL 31

Expert Comment

by:qwaletee
ID: 9856403
Very informative error message!  Can you at leas pin down the line it occured on?

When using Notes COM support, something like this most often happens in an incorrect client install.
0
 
LVL 31

Expert Comment

by:qwaletee
ID: 9856425
Oh, and I gave madheeswar 1/2 hour to follow up!
0
 
LVL 19

Expert Comment

by:madheeswar
ID: 9856467
Yeah. I am trying to figureout what caused problem.
0
 

Author Comment

by:jerahteo
ID: 9856594
I mean its not from the example you have given but its from my program which when it try to initialise the notes session in vb that error occur.
0
 

Author Comment

by:jerahteo
ID: 9856598
Do you mean I need to re-install my Lotus Notes ? That was what I want to try, I have reloaded my VB6 developement tools but that did not help !
0
 
LVL 19

Expert Comment

by:madheeswar
ID: 9856601
what is the version of LOtus Notes ur using?

Can we see the code which ur executing?
0
 

Author Comment

by:jerahteo
ID: 9863394
Ok We have come to the Final round I have kick runtime error. And tested the sample code which qwaletee had provided.

The first sample actually call up the Lotus Notes Address book dialog box and I don;t think I want that

The second sample is good in the sense that It interpret what I wanted it actually went to the server address book and load up all names and email address but I do agree that is no efficient therefore what I can do is that I will load all what I want to a local database and next time when I want any email instead of calling from the server I will call from my local database. Can I can maintain an up to date database by doing a update regularly.

So I conclude here and once again thanks to qwaletee.

You deserve the points.

0
 

Author Comment

by:jerahteo
ID: 9863412
Oh I forgot in your sample you have the following code
Do Until entry Is Nothing
          Print "Address: " entry.columnvalues(1)
          Set entry = people.getNext(entry)
     Loop


The entry.columnvalues(1) is for the field Telephone

0 - Name
1 - Telephone
2 - Company
3 - Email

Well as far as my address book is concern the above value apply, I do not know if this is a standard through out. Just for info
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

For Desktop Techs: How to retain a user's Notes configuration data when swapping out the end user's computer. (Assuming that you are not upgrading to a completely different version of Notes client) All you need to do is: 1) install Notes o…
  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…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

708 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

11 Experts available now in Live!

Get 1:1 Help Now