Solved

Using Lotus Notes with VB

Posted on 2000-02-21
2
208 Views
Last Modified: 2010-05-02
I am trying to use lotus notes from a vb6 application, but with little luck.  I have already tried the MAPI control but it only gets as far as

Session.SignOn

then asks to set outlook as the default mail client.
0
Comment
Question by:jameskennedy
2 Comments
 
LVL 43

Accepted Solution

by:
TimCottee earned 150 total points
ID: 2541876
The following code is posted with full respect to Waty who supplied it to me in the first place.

' #VBIDEUtils#************************************************************
' * Programmer Name  : Waty Thierry
' * Web Site         : www.geocities.com/ResearchTriangle/6311/ 
' * E-Mail           : waty.thierry@usa.net
' * Date             : 7/07/99
' * Time             : 12:48
' **********************************************************************
' * Comments         : Create Attachment file in Lotus Notes
' *
' *
' **********************************************************************

Public Function CreateAttachment(DBName As String, DocId As String, AttachmentPath As String) As Boolean

   Dim session As Object
   Dim db As Object
   Dim doc As Object
   Dim Ob As Object
   Dim rtitem As Object 'NotesRichTextItem
   Set session = CreateObject("Notes.NotesSession")
   Set db = session.GetDatabase("", DBName)
   Set doc = db.GetDocumentByUNID(DocId)
   Set rtitem = doc.CreateRichTextItem("Attachment")
   Set Ob = rtitem.EmbedObject (EMBED_ATTACHMENT, "", AttachmentPath)
   Call doc.Save(True, False)
   Dim ws As Object
   Set ws = CreateObject("Notes.NotesUIWorkspace")
   Call ws.EditDocument(True, doc)

End Function

' #VBIDEUtils#************************************************************
' * Programmer Name  : David Henderson
' * Web Site         : www.geocities.com/ResearchTriangle/6311/ 
' * E-Mail           : waty.thierry@usa.net
' * Date             : 09/09/1999
' * Time             : 13:57
' **********************************************************************
' * Comments         : Sending a mail message to Lotus Notes
' *
' * declare objects for notes objects
' *
' **********************************************************************
Dim session As Object, db As Object, doc As Object, rtobject As Object
Dim rtitem As Object

Dim user As String, server As String, mailfile As String

Rem get a handle to a notes session
Set session = CreateObject("notes.notessession")

user = session.UserName
server = session.GetEnvironmentString("MailServer", True)
mailfile = session.GetEnvironmentString("MailFile", True)
Set db = session.getdatabase(server, mailfile)
Set doc = db.createdocument()    doc.Form = "Memo"
'    doc.SendTo = "david henderson@sehe.com"    doc.sendto = txtTo
'    doc.Subject = "notes mail created from vb"    doc.subject = txtSubject
'   the following lines are only needed when attaching files
'Set rtitem = doc.CreateRichTextItem("body")    doc.body = txtBody

Call doc.Send(False)'   clean up after ourselves    Set session = Nothing
Set db = Nothing    Set doc = Nothing

0
 

Author Comment

by:jameskennedy
ID: 2541967
Top notch.
0

Featured Post

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

830 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