Sign in to follow this  
Followers 0
ositstomc

Lotus Notes Registration

2 posts in this topic

Hi

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")
$Session.Initialize()
   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

IBM

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
Else
      ;MsgBox(64, "Opening Mail DB")
$Maildb.OPENMAIL()
EndIf
;Set up the new mail document
$MailDoc = $Maildb.CREATEDOCUMENT
$MailDoc.Form = "Memo"
$MailDoc.sendto = $recipient
$MailDoc.Subject = $Subject
$MailDoc.Body = $bodytext
$MailDoc.SAVEMESSAGEONSEND = $saveit
;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
Else
MsgBox(0, "LoNo Error", "attachment not found")
Exit
EndIf
$AttachME = $MailDoc.CREATERICHTEXTITEM($filename)
$EmbedObj = $AttachME.EMBEDOBJECT(1454, "", $fullpath, $filename)
;$MailDoc.CREATERICHTEXTITEM($filename)
EndIf
;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.

TomC

 

 

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:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
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  
Followers 0