Word Distinguish between Outlook word email and word document

Joined
Aug 31, 2010
Messages
2
Reaction score
0
Hi,

I am developing an add-in for outlook that consists of creating a customized send button next to the standard one. when outlook is configured to use the word editor, when I add the customized send button to the command bar of the mail in edit mode, the add-in is also added in word document. The reason is that the word editor is activated in outlook. How can I tell my add-in not to add the button in word as well. I don't want to deactivate the editor word. There must be a way how to detect the opened application. I searched for my problem on the internet and people said to test if the kind of the document is word mail or word document. Here's part of my code that didn't work correctly:


//event triggered when item is opened

private void Inspectors_NewInspector(Outlook.Inspector i)

{

//some code to test if it is a maiitem, etc.



Word.Document document = (Word.Document)i.WordEditor;





if (document.Kind.ToString() == "wdDocumentEmail")

addsendbutton();

}

The problem is that the button is still showing at word level. Visual studio is not launching the condition on all the windows. So he’s adding it in word as well, although word document is a wdDocumentLetter.



I have 2 options in mind:



1- The code must not be called at new inspector level. Because this trigger is not launched in the case of the word document

2- The inspector from which we get the word editor is not the right one for word document (Word.Document document = (Word.Document)i.WordEditor;)


Does anyone have an idea about how to solve this? I would really appreciate any help.
Thanks,
Nad
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top