Jump to content
Sign in to follow this  

Lotus Notes Registration

Recommended Posts



Longshot I know but I am hoping someone can help me out on this, I am try to register a Lotus Notes user using the Notes COM object but I am getting really frustrated.  Using the script enclosed I can open the Notes object but the registraion is not working as I expected, The user does not appear in the address book, the mail file is not created, the ID file does not get saved to the disk drive BUT the new ID is created in the ID vault?

I have spent a week trying to debug this but am getting nowhere!, I anyone can help on the Notets sid or even help me debug a COM object I would be really grateful.

Global $oErrorHandler = ObjEvent("AutoIt.Error", "_ErrFunc") ;Catch COM errors

$Session = ObjCreate("Lotus.NotesSession")
   MsgBox(0, "Name", $Session.Commonusername)
$Reg = $Session.CreateRegistration()
$Reg.RegistrationServer = "cn=server1/o=mvr"
$Reg.CertifierIDFile = "c:\cert.id"
$Reg.Mailinternetaddress = "Barney.Rubble@company.com"
$Reg.IDType =172
;$Reg.OrgUnit = "MVR"
$Reg.RegistrationLog = "log.nsf"
$Reg.CreateMailDb = True
$Reg.IsNorthAmerican = True
$Reg.UpdateAddressBook = True
$Reg.StoreIDInAddressBook = True
$Reg.CreateMailDB = True
$User=$Reg.RegisterNewUser("Rubble", "c:\user.id", "CN=server1/O=MVR", "Barney", "",    "certpassword", "", "", "flinstone.nsf", "", "newpassword",175) 
   MsgBox(0, "Status", $User)

Heres some Links I have used to get this far

VB  This guy has coded it in VB


Java  Another guy got it working in Java

On a final Note, just to confirm the Notes object does work, I can use the following to send an email through Notes.

#include <date.au3>

Global $recipient, $Subject, $bodytext, $attachment, $saveit
$recipient = "tomc@domain.com"
$Subject = "test"
$bodytext = "more test"
$attachment = "C:\user.id"
$saveit = True
SendNotesMail($recipient, $Subject, $bodytext, $attachment, $saveit)

Func SendNotesMail($recipient, $Subject, $bodytext, $attachment, $saveit)
;Start a $Session to notes
$Session = ObjCreate("Notes.NotesSession")
;Get the sessions $UserName and then calculate the mail file name
$UserName = $Session.UserName
$MailDbName = StringLeft($UserName, 1) & StringRight($UserName, (StringLen($UserName) - StringInStr(1, $UserName, " "))) & ".nsf"
;Open the mail database in notes
$Maildb = $Session.GETDATABASE("", $MailDbName)
If $Maildb.IsOpen = 1 Then
      ;MsgBox(64, "Mail DB is open")
;Already open for mail
      ;MsgBox(64, "Opening Mail DB")
;Set up the new mail document
$MailDoc.Form = "Memo"
$MailDoc.sendto = $recipient
$MailDoc.Subject = $Subject
$MailDoc.Body = $bodytext
;Set up the embedded $Object and $attachment and attach it
If $attachment <> "" Then
If FileExists(@ScriptDir & "" & $attachment) Then
$filename = $attachment
$fullpath = @ScriptDir & "" & $attachment
ElseIf FileExists($attachment) Then
$pos = StringInStr($attachment, "", 0, -1)
$filename = StringTrimLeft($attachment, $pos)
$fullpath = $attachment
MsgBox(0, "LoNo Error", "attachment not found")
$AttachME = $MailDoc.CREATERICHTEXTITEM($filename)
$EmbedObj = $AttachME.EMBEDOBJECT(1454, "", $fullpath, $filename)
;Send the document
$MailDoc.PostedDate = _Now();Gets the mail to appear in the sent items folder
$MailDoc.SEND(0, $recipient)
$Maildb = "NULL"
$MailDoc = "NULL"
$AttachME = "NULL"
$Session = "NULL"
$EmbedObj = "NULL"
EndFunc ;==>SendNotesMail

Many thanks for your time.




Share this post

Link to post
Share on other sites

If you have a working VB example it shouldn't be too hard to rewrite it for AutoIt.

Unfortunately Lotus Notes isn't widely used here. If you search the forum you won't get too much hits.

My UDFs and Tutorials:


Active Directory (NEW 2018-12-03 - Version - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki

ADO - Wiki


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this