Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Using Lotus Notes with VB

Posted on 2000-02-21
2
Medium Priority
?
225 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
[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
2 Comments
 
LVL 43

Accepted Solution

by:
TimCottee earned 600 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

650 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