Trusted Code - Does not work !!!!

  • Thread starter Thread starter Avril
  • Start date Start date
A

Avril

Hi

I am praying at this stage that someone can help me.

I need to setup a Com-Addin as trusted. I have a VB6
system that automatically sends mail. Since moving to
Outlook 2002 when the VB6 program sends mail outlook
automatically prompts you and tells you that another
program is trying send mail.

I downloaded the Outlook Security Features Adminisitrive
pack and have followed the instructions and it doesn't
work. We have tried a test Com-addin to see if we can get
outlook to see it outlook can see the addin but when it
goes to send a mail the prompt pops up even though we have
the DLL regisitered as trusted code !!!

Someone has to have done this, please if there is anyone
out there that has done this can you help !!!!

Maybe there is something were not setting or something
else we need to do.

Thanks in Advance !

Kind Regards
Avril
 
So can you verify that your COM add-in's DLL is in the Trusted Code page?

Or are you just using the programmatic send automatic allow of the Exchange
options pack?

Have you set the reg key on the clients?

--
Patricia Cardoza
Outlook MVP
www.cardozasolutions.com

Author, Special Edition Using Microsoft Outlook 2003

***Please post all replies to the newsgroups***
 
Are all Outlook objects in your add-in derived from the Application object passed by the OnConnection event handler -- in other words, no CreateObject("Outlook.APplication") or New Outlook.Application statements? What is the scope of your security folder item -- default or specific users?
--
Sue Mosher, Outlook MVP
Outlook and Exchange solutions at http://www.slipstick.com
Author of
Microsoft Outlook Programming: Jumpstart
for Administrators, Power Users, and Developers
 
Actually it does work...If this is Outlook 2002 then you will need the
following...

Please keep in mind that these were headaches I once dealt with so
just smile when you see the hurdles I had to jump or sometimes leap
over.
-------------------------------------------------------------
Outlook version

Outlook 2002 SP1
Outlook 2002 SP2
Outlook 2002 Product Update for January 22, 2003

This will result in a version of Outlook being 10.4712.4219.
-------------------------------------------------------------
Outlook Security Form

You should have a folder at the following location:
Public Folder\All Public Folders\Outlook 10 Security Settings

In this folder you should have the Outlook security form that was
provided to you. You will need to add your application as a com
add-in.

Two quick notes about this

A hash code is generated from characteristics of your application and
saved in the form. Because of this, each time you recompile your DLL,
your will need to update your security from by removing your Com
Add-In and re-adding it. This seems ridiculous, but it's because your
date-time of your DLL has changed.

Also, because the form will trusts your DLL, the trusted application
will not work with VB in debug mode. In debug mode, the name of your
DLL to Outlook is actually VB6DEBUG.DLL not the true name, hence, no
trusting. You will just have to deal with the messages in debug mode.
-------------------------------------------------------------
Registry

The user will have to have a registry setting in their registry as
follows:

HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Security\CheckAdminSettings

This setting is of type DWORD and should be set to 2.
-------------------------------------------------------------
Code-wise

First off, you cannot use any late-binding in your project when
dealing with certain Outlook objects. Keep in mind that a for each
loop is effectively late-binding. For example the following
codesnipped will fail...

Example #1
Do not use either of these: CreateObject("Outlook.Application") or
New Outlook.Application

Change it too...
Dim gobjApp as Outlook.Application
Private Sub IDTExtensibility2_OnConnection(ByVal Application As
Object, ...)
Set gobjApp = Application
End Sub


Example #2
For Each objRecipient in objAppt.Recipients
...
Next

Change it too..
Set objRecipients = objAppt.Recipients
For i = 1 to objRecipients.Count
Set objRecipient = objAppt.Recipients(1)
Next
-------------------------------------------------------------
One final note. The trusted application stuff works only with the
Outlook Object Model and not CDO so don't use CDO where you need
trusted code.


I hope I didn't forget anything, good luck. :)
 
Hi

Thanks for your quick response.

I don't have anything in the OnConnection routine.

You see before we implement this into the VB system we
have. To make sure that it works we set up a test.Which is
just a Dll with a form with a button on it and when you
press this button it sends a mail.In the Onconnection
rountine we just display the form with the button on it to
send a mail. We compiled the dll and put it in as trusted
code so when the form loads and you press the button i
would expect it to work and no prompts appear but the
prompts still appear which is very annoying i cant see
what we are doing wrong !!!!

The scope of the security folder items is default.

I can not see what we are doing wrong, this really
frustrating as we can not get it work.

Kind Regards
Avril
-----Original Message-----
Are all Outlook objects in your add-in derived from the
Application object passed by the OnConnection event
handler -- in other words, no CreateObject
("Outlook.APplication") or New Outlook.Application
statements? What is the scope of your security folder
item -- default or specific users?
--
Sue Mosher, Outlook MVP
Outlook and Exchange solutions at http://www.slipstick.com
Author of
Microsoft Outlook Programming: Jumpstart
for Administrators, Power Users, and Developers


"Avril" <[email protected]> wrote in
message news:[email protected]...
 
Thanks for your reply.

before we implement this into the VB System that we have.
We wanted to setup a test Com-addin and get that working
as trusted which is what i am trying to do.

What i done was create a DLL which has form with a button
on it and when you press this button it sends a mail. We
wanted this to work so that when we put it as trusted and
you press the button you dont get those annoying prompts
that outlook pops up for sending programmatic mail.

In the OnConnection routine i just display the form with
the button on it so that we can try a test. But when you
press the button even though the DLL is set to trusted you
still get the prompts appearing.

I was just wondering is there other code i should have in
there also ???

Kind Regards
Avril
 
Hi

Thanks for your reply.

Yes my Com-Addin's DLL is in the trusted code page and i
am not using the programmatic send automatic options pack.

As i am testing this on my own pc first i have set the Reg
key on my pc to 2 which is what it said to set it to.

Kind Regards
Avril
 
That's probably your problem. When you trust an Outlook COM add-in, what is actually trusted is the Application object passed by the OnConnection event handler. Any other object that you want to be trusted must derive from this one Application object. Standard coding technique is to set a global object variable to that Application object. The samples in the Resources section at http://www.microeye.com demonstrate this and other COM add-in best practices.
 
Hi Sue,

Thanks for your quick response and help.
I'll take a look at the samples and hopefully get sorted.
Thanks Again.
Ave
-----Original Message-----
That's probably your problem. When you trust an Outlook
COM add-in, what is actually trusted is the Application
object passed by the OnConnection event handler. Any other
object that you want to be trusted must derive from this
one Application object. Standard coding technique is to
set a global object variable to that Application object.
The samples in the Resources section at
http://www.microeye.com demonstrate this and other COM add-
in best practices.
message news:[email protected]...
 
If you followed the steps I listed, it should work for you with the
compiled DLL, not in debug mode.

Please verify the version of Outlook you are using.

Keep in mind that what is trusted is the application object that is
passed to you in the OnConnection method. Use the application object
to send the email and it should work.

Please let me know if that still does not work for you.
 
Hey if you still can't get it to work, contact me at
(e-mail address removed) and I will help you further.

I honestly does work and although it's hokey in nature, when you have
it setup it's quite easy. I actually send our app out with the
security form and it works flawlessly on customer sites.
 
Hi Thanks for your response.

The version of outlook i am using is 10.2627.2625.

When you say use the application object to send the mail
what exactly do you mean ?

You see i use an Add-in template to create the dll and i
have a form in there with a button that when you press
sends a mail message.In the OnConnection routine i just
have frmEmail.Show which pops up the form.

Do you know anywhere i can find examples of this ?

Really appreciate your help !!!

Ave
 
Back
Top