I have to use a custom form for my message class "IPM.Note.MyClass"
for outlook clients not supporting vsto and form regions.
For Outlook 2007 I use a VSTO Addin and form regions registerd for
message class "IPM.Note.MyClass" too.
Outlook 2007 has a problem with both registered forms. It seems, the
custom form (MAPI) locks the MailItem object in the VSTO Addin.
Is it possible, to prevent only Outlook 2007 from loading custom
form?
The switch to bypass forms is not an option because of a popup
messagebox with a warning, that custom form can't be loaded.
Can you please explain what you mean by "locks the MailItem object in the
VSTO Addin"?
If you want a standard form to display instead of a custom form, you can
probably close an Inspector in the Inspectors.NewInspector event if the
Inspector.CurrentItem.MessageClass doesn't evaluate to your desired message
class.
--
Eric Legault [MVP - Outlook]
MCDBA, MCTS (Messaging & Collaboration, SharePoint Infrastructure, MOSS 2007
& WSS 3.0 Application Development)
Collaborative Innovations
-> Try Picture Attachments Wizard For Microsoft Outlook <-
Web: http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault
"uku" <kurze-bus@web.de> wrote in message
news:14ad7d7c-d1e4-4c16-b94a-5f063ece7611@r66g2000hsg.googlegroups.com...
> Hi,
>
> I have to use a custom form for my message class "IPM.Note.MyClass"
> for outlook clients not supporting vsto and form regions.
> For Outlook 2007 I use a VSTO Addin and form regions registerd for
> message class "IPM.Note.MyClass" too.
> Outlook 2007 has a problem with both registered forms. It seems, the
> custom form (MAPI) locks the MailItem object in the VSTO Addin.
>
> Is it possible, to prevent only Outlook 2007 from loading custom
> form?
>
> The switch to bypass forms is not an option because of a popup
> messagebox with a warning, that custom form can't be loaded.
>
>
> Thx Uwe
I guess that the mailitem object is locked, because I get it over
item = _application.ActiveExplorer().Selection[x] as IOutlook.MailItem
and the item is not null, but every item's property is set to null.
This behavior only happens, if I have registered a mapi custom form
against the custom message class of the selected item.
If I prevent outlook from loading the custom form (unregister the Mapi
form in the organization forms library) I can access every property
of the selected item in my VSTO addin.
I can't use the NewInspector event because I don't open the selected
item explicit.
I have a button in the toolbar and after the click event I get the
selected item(s) and try to read some properties, but this fails
because of an exception:
System.Runtime.InteropServices.COMException (0x8002801D): Bibliothek
nicht registriert. (Exception from HRESULT: 0x8002801D
(TYPE_E_LIBNOTREGISTERED))
at Microsoft.Office.Interop.Outlook._MailItem.get_Parent()
I can find the same behavior with the outlook spy addin by Dmitry
Streblechenko:
If I show selected Outlook "Item" object(s) by clicking the button
"Item", I get a property page where all properties are null.
I recapitulate if I have the custom form registered, this form will be
loaded immediate after clicking the "Item" button, no properties will
be available.
If there is no registered custom form everything will be perfect, I
can read every property.
Back to my question, is it possible to prevent outlook from loading a
custom form for the outlook 2007 clients only (the other clients needs
the custom form) ?