Can not add CommandBar if "Word 2003 to read Rich Text e-mail" isselected.

  • Thread starter Thread starter er.nikhil.sharma
  • Start date Start date
E

er.nikhil.sharma

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
 
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
 
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.
 
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
 
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)?
 
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
 
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.
 
Back
Top