Group:  Microsoft Outlook ยป microsoft.public.outlook.program_addins
Thread: Can not add CommandBar if "Word 2003 to read Rich Text e-mail" is selected.

Geek News

Can not add CommandBar if "Word 2003 to read Rich Text e-mail" is selected.
"er.nikhil.sharma[ at ]gmail.com" <er.nikhil.sharma[ at ]gmail.com> 10/14/2008 10:01:09 AM
Hi,

I have to add CommandBar in inspector (Outlook 2003).
I am handling "NewInspector" event and getting handle of inspector.

I face problem when i receive an e-mail with Rich Text and open it.
As Word 2003 is selcted as default editor to read e-mails with rich
Rich Text, whatever CommandBar I add to the inspector is not visible.

inspector.IsWordMail() -> returns me false.
inspector.WordEditor -> returns me null. (Security Pop-up as well)
inspector.HTMLEditor -> returns me null.
inspector.EditorType -> returns me "olEditorRTF".

Is there any solution available for this ?

Thanks and Best Regards,
Nikhil Sharma

Re: Can not add CommandBar if "Word 2003 to read Rich Text e-mail" is selected.
"er.nikhil.sharma[ at ]gmail.com" <er.nikhil.sharma[ at ]gmail.com> 10/14/2008 10:04:16 AM
Additional Note :

Hi,
I am not facing the same issue, if i open new (mail) inspector (and
ofcourse "Word 2003 to edit e-mail" is selected), here also i am
receiving same "NewInspector" event and in this case, whatever
CommandBar i add to inspector gets added to the word editor, and
after this step if i open existing mail then also i can see this
CommandBar which i created while New (mail) Inspector. But issue is,
if i do not open New (mail) inspector first, and i open existing mail
first, this CommandBar is not added to word Editor.
I debugged and found out, once you open new (mail) inspector it gives
you Word Editor handle, but in existing mail it gives you Outlook
default editor handle.
why this kind of discrepancy is there i dont have any idea.

Thanks and Best Regards,
Nikhil Sharma
Re: Can not add CommandBar if "Word 2003 to read Rich Text e-mail" is selected.
"Ken Slovak - [MVP - Outlook]" <kenslovak[ at ]mvps.org> 10/14/2008 1:32:25 PM
Try waiting for the initial Inspector.Activate() event before you test for
IsWordMail() or try to get WordEditor or adding your UI. See if that helps.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


<er.nikhil.sharma[ at ]gmail.com> wrote in message
news:a9103958-0130-49dc-ad96-2e2344e6b8c4[ at ]k7g2000hsd.googlegroups.com...
[Quoted Text]
> Additional Note :
>
> Hi,
> I am not facing the same issue, if i open new (mail) inspector (and
> ofcourse "Word 2003 to edit e-mail" is selected), here also i am
> receiving same "NewInspector" event and in this case, whatever
> CommandBar i add to inspector gets added to the word editor, and
> after this step if i open existing mail then also i can see this
> CommandBar which i created while New (mail) Inspector. But issue is,
> if i do not open New (mail) inspector first, and i open existing mail
> first, this CommandBar is not added to word Editor.
> I debugged and found out, once you open new (mail) inspector it gives
> you Word Editor handle, but in existing mail it gives you Outlook
> default editor handle.
> why this kind of discrepancy is there i dont have any idea.
>
> Thanks and Best Regards,
> Nikhil Sharma

Re: Can not add CommandBar if "Word 2003 to read Rich Text e-mail" is selected.
"er.nikhil.sharma[ at ]gmail.com" <er.nikhil.sharma[ at ]gmail.com> 10/15/2008 9:39:49 AM
Hi Ken Slovak,
Thanks for response,
Your suggestion helped me to had littile progress but not the
solution.

As per your suggestion i handled "NewInspector" Event and in that
handler i register "((InspectorEvents_10_Event)Inspector).Activate"
Event.
So when execution comes to Activate Event handler, Properties values
are now as follows :

inspector.IsWordMail() -> returns me false. -> now it returns me true
inspector.WordEditor -> returns me null. (Security Pop-up as well) ->
still same :(
inspector.HTMLEditor -> returns me null. (Security Pop-up as well) ->
still same
inspector.EditorType -> returns me "olEditorRTF". -> now it returns me
"olEditorWord"

so still i am not able to add my CommandBar to inspector.

And when i try activate inspector by using code it thorws me exception
"Unable to display item." (COMException -> ErrorCode : 0xfbc20009)

I need to show my toolbar once inspector is visible. and i didn't find
any Displayed/VisibleChange Event or Activated Event in Outlook object
model.
Surprisingly everything (same code) is working fine for new inspector.
(create new mail), as i mentioned in my additional note.

In your opinion, is any solution available for this issue?

Thanks and Best Regards,
Nikhil Sharma
Re: Can not add CommandBar if "Word 2003 to read Rich Text e-mail" is selected.
"Ken Slovak - [MVP - Outlook]" <kenslovak[ at ]mvps.org> 10/15/2008 3:27:41 PM
Is this version of Word from the same package and SKU as the Outlook
version?

It's odd that you get IsWordMail() == true but get an error and security
popup when accessing WordEditor. Is this a VSTO addin or a shared managed
code addin?

Are you deriving all of your Outlook objects from the Application object
passed to you in your startup event handler (either Startup or
OnConnection)?

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


<er.nikhil.sharma[ at ]gmail.com> wrote in message
news:2b9849a0-675e-4700-8152-a7adc1af5791[ at ]b31g2000prf.googlegroups.com...
[Quoted Text]
> Hi Ken Slovak,
> Thanks for response,
> Your suggestion helped me to had littile progress but not the
> solution.
>
> As per your suggestion i handled "NewInspector" Event and in that
> handler i register "((InspectorEvents_10_Event)Inspector).Activate"
> Event.
> So when execution comes to Activate Event handler, Properties values
> are now as follows :
>
> inspector.IsWordMail() -> returns me false. -> now it returns me true
> inspector.WordEditor -> returns me null. (Security Pop-up as well) ->
> still same :(
> inspector.HTMLEditor -> returns me null. (Security Pop-up as well) ->
> still same
> inspector.EditorType -> returns me "olEditorRTF". -> now it returns me
> "olEditorWord"
>
> so still i am not able to add my CommandBar to inspector.
>
> And when i try activate inspector by using code it thorws me exception
> "Unable to display item." (COMException -> ErrorCode : 0xfbc20009)
>
> I need to show my toolbar once inspector is visible. and i didn't find
> any Displayed/VisibleChange Event or Activated Event in Outlook object
> model.
> Surprisingly everything (same code) is working fine for new inspector.
> (create new mail), as i mentioned in my additional note.
>
> In your opinion, is any solution available for this issue?
>
> Thanks and Best Regards,
> Nikhil Sharma

Re: Can not add CommandBar if "Word 2003 to read Rich Text e-mail" is selected.
"er.nikhil.sharma[ at ]gmail.com" <er.nikhil.sharma[ at ]gmail.com> 10/16/2008 8:17:10 AM
Hi Ken Slovak,

Is this version of Word from the same package and SKU as the Outlook
version?
Yes, word is from the same package as the outlook
version.

Is this a VSTO addin or a shared managed
code addin?
It is VSTO Addin

Are you deriving all of your Outlook objects from the Application
object
passed to you in your startup event handler (either Startup or
OnConnection)?
Yes, i am deriving all of my out look objects from the
application object passed to me in Startup

It looks strange to me too that i am getting
Inspector.IsWordEmail()==true and Inspector.WordEditor = null

Is there any Event available as "Activated", because i feel "Activate"
Event is fired before Inspector Activation. If i Receive this event
after Activation then i feel the proble will be resolved.

Thanks and Best Regards,
Nikhil Sharma
Re: Can not add CommandBar if "Word 2003 to read Rich Text e-mail" is selected.
"Ken Slovak - [MVP - Outlook]" <kenslovak[ at ]mvps.org> 10/16/2008 1:54:48 PM
There's no such event, and I've never needed it.

I just use the first Inspector.Activate() event and in that event I check
for the Outlook version. If it's less than 12 (Outlook 2003 or earlier) and
..IsWordMail() == true I call to initiate my Word objects like this, where
"_insp" is my wrapper class level Inspector object, and "_doc" is a class
level Word.Document object:

_doc = (Word.Document)_insp.WordEditor;

That works just fine for me.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


<er.nikhil.sharma[ at ]gmail.com> wrote in message
news:76168e82-d522-420b-9d69-7f942168563c[ at ]k30g2000hse.googlegroups.com...
[Quoted Text]
> Hi Ken Slovak,
>
> Is this version of Word from the same package and SKU as the Outlook
> version?
> Yes, word is from the same package as the outlook
> version.
>
> Is this a VSTO addin or a shared managed
> code addin?
> It is VSTO Addin
>
> Are you deriving all of your Outlook objects from the Application
> object
> passed to you in your startup event handler (either Startup or
> OnConnection)?
> Yes, i am deriving all of my out look objects from the
> application object passed to me in Startup
>
> It looks strange to me too that i am getting
> Inspector.IsWordEmail()==true and Inspector.WordEditor = null
>
> Is there any Event available as "Activated", because i feel "Activate"
> Event is fired before Inspector Activation. If i Receive this event
> after Activation then i feel the proble will be resolved.
>
> Thanks and Best Regards,
> Nikhil Sharma

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net