All your objects need to derive from the Application object passed by the OnConnection event. Also, if you are connection to Exchange and have the CheckAdminSettings registry value set to anything other than 0, then Exchange administrator will need to set up a security settings item that trusts your add-in. See
http://www.outlookcode.com/d/sec.htm
--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx
"David Zhu" <(E-Mail Removed)> wrote in message news

7131077-4DBE-4BAB-9162-(E-Mail Removed)...
> I'm programming a COM Add-in for outlook2003. UnFortunately, the warning
> dialog box always popes up what I tries to save a sent mail item
> programmally.like this:
>
> '**********************************************
> Dim olApp As Outlook.Application
> Dim objMailItem As Outlook.MailItem
> Set olApp = Application
> Set objMailItem = olApp.Session.GetDefaultFolder(olFolderSentMail).Items(1)
> Call SaveMailItemAsFile(objMailItem, sFullPath)
> '***********************************************
>
> So I researched MSDN and found an example of article "What's New in
> Microsoft Office Outlook 2003 for Developers?", which said that would avoid
> secure warning dialog box:
>
> Sub TrustedCode()
> Dim olApp As Outlook.Application
> Set olApp = Application
> Dim oMail As Outlook.MailItem
> Set oMail = _
> olApp.Session.GetDefaultFolder(olFolderInbox).Items(1)
> MsgBox oMail.SenderEmailAddress, vbInformation
> End Sub
>
> But it doesn't work, in fact. How could I do?Somebody helps me.
>
>