Outlook Security Prompts

Add-in Express™ Support Service
That's what is more important than anything else

Outlook Security Prompts
 
Rick Koch




Posts: 172
Joined: 2006-09-05
Using VSTO 2005, C#, the .Net VSTO version of ADX

I removed my wrapper code and replaced it with ADX. Now, all of a sudden, I'm getting Outlook security prompts while working with contacts. What should I be looking for, or doing differently? I imported the ADX key with the framework configuration applet, and set it to full trust. Is there something else I need to do? I never got prompted when I was managing my own wrappers.
Posted 19 Sep, 2006 18:30:33 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Hi Rick.

Have you used the'wrapper code' in a COM Add-in before?
Posted 20 Sep, 2006 08:43:25 Top
Rick Koch




Posts: 172
Joined: 2006-09-05
I have existing event code which ran without prompts when called from my own toolbars which were managed by toolbar and window wrapper classes.

I pulled my wrapper classes out and put an ADX module in my project. In the constructor, after initialization, I pointed the button click events at the same event code I was using previously. Now I get prompts when reading contacts, even though the actual contact code is unchanged.

I used an import strategy to add the ADX module. I built the module code in a separate test app, created a new ADX module in my project code, and then replaced the ADX module files with the files from the test app. Everything seems to work except for the prompting.

My understanding is that a completely internal, fully trusted addin should not prompt. I suppose that's debatable, but the fact is that the same events worked when I triggered them from my own toolbars. One of the warnings I've read is that all components have to be trusted (because of the "stack walk" security). So I'm wondering if I have to do something to keep ADX from triggering the prompts.
Posted 20 Sep, 2006 10:58:50 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Hi Rick.

Can you send me the event code? I will check it.
Posted 21 Sep, 2006 08:05:38 Top
Rick Koch




Posts: 172
Joined: 2006-09-05
I will see if I can duplicate the problem with code that I can send. We're dependent on some third-party libraries that would not be portable to your system.

Rick
Posted 21 Sep, 2006 11:43:09 Top
Rick Koch




Posts: 172
Joined: 2006-09-05
I sent you some code. I think the problem lies in this syntax --

... = new Outlook.Application().ActiveInspector();

The problem is that the Object Model Guard wants everything derived from the Application object originally passed by the OnConnection event. The "new" statement above introduces objects that were not derived from the original application object.

In my original code, the click event included a reference to the associated item or selection. But since you use "obect sender," and since I have no idea what "sender" is, I'm now instantiating a new application object so I can get a reference to the ActiveInspector/ActiveExplorer.

I've got a couple ways to get around this -- what would you recommend?
Posted 21 Sep, 2006 15:57:38 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Rick, please try the code below to get the active inspector/explorer.

You have the following code in the ADXModule:

internal Outlook._Application OutlookApp
{
get
{
return (HostApplication as Outlook._Application);
}
}

The Active inspector is:
Outlook.Inspector insp = OutlookApp.ActiveInspector();

The Active explorer is:
Outlook.Explorer expl = OutlookApp.ActiveExplorer();
Posted 21 Sep, 2006 17:13:20 Top
Rick Koch




Posts: 172
Joined: 2006-09-05
Thanks, that will do what I'm after.
Posted 22 Sep, 2006 07:54:23 Top