Solved

Notes and VB using notes automation classes

Posted on 1998-12-09
4
300 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 200 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

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

Suggested Solutions

This article covers general Notes 8.5 troubleshooting information including recreating the Notes\Data folder.
Article by: Rob
Notes 8.5 Archiving Steps and Tips This article covers setting up a Notes archive, and helps understand some of the menu choices making setting up and maintaining a Notes archive file easier.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

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

13 Experts available now in Live!

Get 1:1 Help Now