?
Solved

Notes and VB using notes automation classes

Posted on 1998-12-09
4
Medium Priority
?
326 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

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…
For users on the Lotus Notes 8 Standard client, this article provides information on checking the Java Heap size and adjusting it to half of your system RAM in attempt to get the Lotus Notes 8.x Standard client to run faster.  I've had to exercise t…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

719 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