Re: Avoiding security dialog when automating Outlook






"Cindy Winegarden" <cindy_winegarden@xxxxxxx> wrote in message
news:%23zcStBp3FHA.636@xxxxxxxxxxxxxxxxxxxxxxx
> Hi Steve,
>
> You can do this by using a third-party DLL called Redemption. See
> http://www.dimastr.com/redemption/home.htm . Here's some example code:
>
>
> *-- --------------------------------------
> *-- Automate Outlook to send mail with attachments
> *-- NOTE: Due to security issues with Outlook 2000 SPx and above
> *-- this class depends on the presence of the Redemption.DLL
> *-- http://www.dimastr.com/redemption/home.htm
> DEFINE CLASS cusOutlookAutomation AS Custom
>
> *-- Regular email properties
> Recipients = ""
> Subject = ""
> Body = ""
> Attachments = ""
>
>
> oSendButton = ""
> *oMapiUtils = ""
> oMailITem = ""
> oOutlook = ""
> oSafeMailItem = ""
>
>
> *-- --------------------------------------
> FUNCTION Init()
>
> WITH THIS
>
> *-- Outlook will only run one instance. This will get a handle if one
> is already running.
> .oOutlook = GETOBJECT(, "Outlook.Application")
>
> ENDWITH
>
> ENDFUNC
>
> *-- --------------------------------------
> FUNCTION CreateItem()
>
> WITH THIS
>
> *-- The Outlook email Item
> .oMailItem = .oOutlook.CreateItem(0) && olMailItem
>
> *-- The SafeMailItem which we can actually send
> .oSafeMailItem = CREATEOBJECT("Redemption.SafeMailItem")
> .oSafeMailItem = .oMailItem
>
> *-- Populate the properties
> .oSafeMailItem.To = .Recipients
> .oSafeMailItem.Subject = .Subject
> .oSafeMailItem.Body = .Body
> .oSafeMailItem.Attachments.Add(.Attachments)
>
> *-- "Send" the item to the Outbox
> .oSafeMailItem.Recipients.ResolveAll()
> *..Send()
>
> ENDWITH
>
> ENDFUNC
>
> *-- --------------------------------------
> *-- This sends all the items in the Outbox at once
> FUNCTION Send()
>
> WITH THIS
>
> .oSafeMailItem.Send()
> *.oMapiUtils.DeliverNow()
>
> *-- We must use the Outlook Send button to actually send the messages
> *-- Get the object reference to the Outlook Send button
> .oSendButton = .oOutlook.ActiveExplorer.CommandBars.FindControl(1, 5488)
> .oSendButton.Execute()
>
> ENDWITH
>
> ENDFUNC
> EndDefine
>
> --
> Cindy Winegarden MCSD, Microsoft Visual FoxPro MVP
> cindy_winegarden@xxxxxxx www.cindywinegarden.com
> Blog: http://spaces.msn.com/members/cindywinegarden
>
>
> "Steve Freides" <steve@xxxxxxxxxxxxxxxxxxx> wrote in message
> news:3snhl2Fokmd7U1@xxxxxxxxxxxxxxxxx
>> How to I avoid the security warning when I access
>>
>> Inbox.Body
>>
>> while automating Outlook? I'm using Outlook 2003.
>>
>> Thanks in advance.
>>

If your Outlook client is talking to an Exchange server in-house, there is
an Exchange group setting (assuming you are talking to Exchange) that will
allow the client to avoid this dialog. You also have to make a registry
setting on the client. This will allow you avoid the dialogs without the
third party kludge. Its documented on the Microsoft site, not at work so I
don't have the link at hand.

Mike


.