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
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