Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Notes and VB using notes automation classes

Posted on 1998-12-09
4
Medium Priority
?
329 Views
Last Modified: 2013-12-18
I am using notes automation classes to send mail via a VB application. I am able to hard code a recipient. How would I use the automation classes to access and display a notes address book in VB. I am looking for a code example.
0
Comment
Question by:curtist
  • 3
4 Comments
 
LVL 13

Accepted Solution

by:
Mirkwood earned 800 total points
ID: 1117787
Here is how to mail.
Private Sub Command1_Click()
' Under Project|References, you must check the references to Lotus Notes Automation Classes
Set NOTESSESSION = CreateObject("Notes.NotesSession")
'The first set of quotes contains the database location, the second set contains the nsf file for the
'individual user.  This is specific for each user.  In a full fledged application, I save that in an
'ini file that is read in at run time.
Set NOTESDATABASE = NOTESSESSION.GetDatabase("PHX_SHR_NOTES03/American Express", "MAIL\jmartin.nsf")
Set NOTESDOCUMENT = NOTESDATABASE.CreateDocument
Set NotesRichText = NOTESDOCUMENT.CreateRichTextItem("Body")

NOTESDOCUMENT.Subject = "Testing"
NOTESDOCUMENT.Body = "Attached file is here"
NOTESDOCUMENT.SendTo = "Jason J Martin"
NOTESDOCUMENT.savemessageonsend = True
NOTESDOCUMENT.send False

End Sub

The address book is similar, just open the address book db and read the data.

0
 
LVL 13

Expert Comment

by:Mirkwood
ID: 1117788
You can use the notessession.addressbooks
0
 
LVL 13

Expert Comment

by:Mirkwood
ID: 1117789
Sub Click(Source As Button)
  Dim session As New NotesSession
  Dim books As Variant
  Dim view As NotesView
  Dim doc As NotesDocument
  Dim done As Variant
  Dim person As String
  books = session.AddressBooks
  done = False
  person = Inputbox$ _
  ( "Enter the last name of the person: ", "Last name" )
  Forall b In books
    ' check every public address book,
    ' unless we're already done
    If ( b.IsPublicAddressBook ) And ( Not done ) Then
      Call b.Open( "", "" )
      ' look up person's last name
      ' in People view of address book
      Set view = b.GetView( "People" )
      Set doc = view.GetDocumentByKey( person )
      ' if person is found, display the phone number item
      'from the Person document
      If Not ( doc Is Nothing ) Then
        Messagebox( "Phone for " + person  _
        + " is " + doc.OfficePhoneNumber( 0 ) )
        done = True
      End If
    End If
  End Forall
  ' if done is still false, the person wasn't found
  If Not done Then
    Messagebox _
    ( "Sorry, unable to locate person's name." )
  End If
End Sub
0
 

Author Comment

by:curtist
ID: 1117790
Thank you very much !!!
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

This is an old article, please see an updated version of this article, located here: http://www.experts-exchange.com/articles/23619/Notes-8-5x-Windows-7-Notes-info-and-tips.html
Lack of Storage capacity is a common problem that exists in every field of life. Here we are taking the case of Lotus Notes Emails, as we all know that we are totally depend on e-communication i.e. Emails. This article is fully dedicated to resolvin…
Loops Section Overview
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…

886 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