Want to send email via a command but everytiime Outlook throughs a warning. I want to turn this warning off via the registry.
The code below creates REG_SZ but I need DWORD.
(defun c:test ()
(vl-registry-write "HKEY_CURRENT_USER\\Software\\Policies\\Microsoft\\Office\\15.0\\outlook\\security" "AdminSecurityMode" "3")
(vl-registry-write "HKEY_CURRENT_USER\\Software\\Policies\\Microsoft\\Office\\15.0\\outlook\\security" "PromptOOMSend" "2")
(vl-registry-write "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Office\\15.0\\Outlook\\Security" "ObjectModelGuard" "2")
)
I have found this, but it does not work nor do i understand it. (below)
(defun c:testing ()
(setq wssh (vlax-create-object "WScript.Shell"))
(vlax-invoke-method wssh 'RegWrite "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Office\\15.0\\Outlook\\Security"
(vlax-make-variant 0 2) "REG_DWORD")
(vlax-release-object wssh)
)
Any thoughts
Solved! Go to Solution.
Here is a snipet from the finished working code. This was part of a larger "if" statement for turning off the outlook security warning when sending an email via the lisp.
(progn
;;;turn msoutlook warning off
(alert "Your Outlook settings must be updated. The system will Close Outlook and reopen it now. This is a one time setup operation.")
(vl-registry-write "HKEY_CURRENT_USER\\Software\\Policies\\Microsoft\\Office\\15.0\\outlook\\security" "PromptOOMSend" 2)
(vl-registry-write "HKEY_CURRENT_USER\\Software\\Policies\\Microsoft\\Office\\15.0\\outlook\\security" "AdminSecurityMode" 3)
(vl-registry-write "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Office\\15.0\\Outlook\\Security" "ObjectModelGuard" 2)
;;;end regedit
;;;close and reopen outlook with batch operation
(command "shell" "\\\\cporldata\\trust\\Software\\Batch\\Closerestartoutlook.bat")
;;;end
;;;get date and time then write to log file
(setq mooddate (menucmd "m=$(edtime,$(getvar,DATE),MO/DD/YY)"))
(setq moodtime (menucmd "m=$(edtime,$(getvar,DATE),HH:MM:SS)"))
(setq combine (strcat mooddate "," moodtime "," "Help"))
(setq f (open "\\\\cporldata\\Antikythera\\MoraleLog.csv" "a"))
(write-line combine f)
(close f)
;;;end
;;;send email
(setq olApp (vlax-get-or-create-object "Outlook.Application"))
(setq objMail (vlax-invoke olApp 'CreateItem 0))
(vlax-put-property objMail 'Subject "my subject")
(vlax-put-property objMail 'To "email@address")
(vlax-put-property objMail 'Body "message body.")
(vlax-invoke objMail 'Send)
;;;end if not
)
Can't find what you're looking for? Ask the community or share your knowledge.