ositstomc Posted May 29, 2013 Posted May 29, 2013 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. expandcollapse popup#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
water Posted May 29, 2013 Posted May 29, 2013 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 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now