Solved

Using Lotus Notes with VB

Posted on 2000-02-21
2
215 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 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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

Suggested Solutions

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
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…

734 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