[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 217
  • Last Modified:

Access Notes Object from VB

I want to send a notes mail, under control of VB.  I have connected to the notes object and tried the following code:

Dim session As Object
Dim db As Object
Dim doc As Object
Dim s As String


Set session = CreateObject("Notes.NotesSession")

Set db = session.CURRENTDATABASE
Set doc = db.CREATEDOCUMENT
doc.Form = "Memo"
doc.SendTo = "Raymond J Michels/BALT/BDX"
doc.Subject = "Here's the document you wanted"
Call doc.SEND(False)

Session is valid, because I can access a value like NotesVersion.  But the session.CurrentDatabase is returning Nothing, not setting the db variable.

At one point this started working, but it mostly fails:

1) Why?
2) Is there any web based document on accessing the notes object (better than what comes in notes help).

Thanks
0
rmichels
Asked:
rmichels
  • 3
  • 3
1 Solution
 
dalehendCommented:
There is a VB demo that comes with LSX toolkit at
http://www.lotus.com/home.nsf/welcome/developernetwork

In the example, it uses:
 
Call db.openmail       'set database to default mail database
0
 
rmichelsAuthor Commented:
I'm not sure this answers my question (without looking at the lSX toolkit).

In my example, the db object is Nothing, so I can't access it to do the OpenMail method.

Comments?
0
 
dalehendCommented:
That function db.openmail sets the db to the default mail database(I think it gets it from NOTES.INI), so it does not matter if db is set to NOTHING.
0
Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

 
rmichelsAuthor Commented:
Trying to do this in VB, db must be something, not nothing.  VB will display an error if you try to use the a method on an object that is nothing.
0
 
dalehendCommented:
I should have posted more of the routine from the example:
Private Sub Form_Load()
's and db declared in general as object
Set s = CreateObject("Notes.Notessession")  'create notes session
Set db = s.getdatabase("", "")       'set db to database not yet named
Call db.openmail       'set database to default mail database


I hope this makes it more clear for you how to set db.
0
 
rmichelsAuthor Commented:
Thanks.  It works now :)
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now