I'm developing an add-in in c# for outlook's 2007 and 2010.
Lets say I have Outlook.MailItem object of currently displayed mail and I want to replace part of the mail text with buttons, that would call an internal add-in function (passing some parameters of course). Is that even possible to make that callback to add-in function? If yes then could you guys put me on the right track, because I can't seem to find anything related to this.
To my knowledge, you cannot add buttons to the MailItem.Body. The best you could do is add items to the Ribbon UI based upon the message body's content. There are also similar methods using custom Task Panes and Form Regions.
You can try working with the Word Editor directly, but I have not tried that path.
Outlook.Inspector inspector = Globals.ThisAddIn.Application.ActiveInspector();
Word.Document document = (Word.Document)inspector.WordEditor;
Related
I want to create a Add-In for Outlook 2010 that shows a text field under the subject line of a new mail, when the user types something in.
Therefore I have to catch the event, when the subject line is selected and when content changes.
I googled quite a while, but I still have no idea how to programm it.
Any ideas / suggestions?
MailItem.PropertyChange event will fire only after the user tabs out of the Subject edit box. If you want to see the changes as the user types, your only choice is to hook the Subject edit box window proc and intercept the messages on the Windows API level.
I have a custom Ribbon Split button in outlook. I ideally want to invoke the top button of the split button(not the drop down) from my outlook Add-in. To do that I got the control of split button using Redemption and when i try to execute it I am getting IAccessible Error.I am able to invoke any other normal button with this approach. I googled around all things but not able to find the solution. Any help or suggestion will be of great help. below code shows how I got the control of button
Redemption.SafeRibbonControl newControl = cRibbon.Controls.Item("Add With Template");
newControl.Execute();
Outlook Addin written in C#, Visual Studio 2012.
3 questions:
I have a form window in my outlook addin, it takes it's own space in the taskbar. A right click on it reveals the Outlook jumplist. I would like to customize the jumplist of only my addin taskbar entry.
If that's not possible then manipulating the Outlook jumplist would be the alternative.
How do I do it?
How do I make sure that the addin outlook on startup operations only happen when starting the first Outlook instance? I could realize that via registry or a hidden file but that doesn't seem satisfying.
Additionally I would like to hand over the addin object instances to one of the remaining Outlook instances if the first one is closed.
Or at least let the remaining instances realize that the first one got closed so they can build up the addin functionality again.
I have no idea at all how to do that. Is there any object accessible via my c# code that all Outlook instances interact with to let them communicate?
What jumplist are you referring too? How do you want to customize it?
& 3. Only one Outlook.exe instance should be running at once. When a new Outlook window opens, it adds to the Application.Explorers collection
I have created an Outlook Add-In that adds a button to the ribbon of a new email window, but it's causing a problem.
Here is what happens:
User has Outlook Open.
User opens Excel.
User sends excel document to someone via File->Save and Send->Send as Attachment
User makes a change to the document
User attempts to close the document
This is when Outlook prompts the user to save the file, but the dialog box is hidden behind the Excel window and the user can't get to it without doing some shenanigans.
My Outlook Add-in does many other things, but I've pinned it down to the Ribbon.cs file I created to add a button to the new email window. When I change the RibbonType property of the OfficeRibbon object from Micorosft.Outlook.Mail.Compose to nothing, the Save Dialog shows as it should. When I change it back to "Compose", it hides the dialog box again.
Does anyone know of any way around this? I have confirmed this happens when the project is either an Outlook 2007 Add-In or an Outlook 2010 Add-In.
Thanks in advance.
So in reference to the link sent by user1217053 the answer would probably be along the lines of...
create a class scope field for the Outlook.Mailitem
have it bind to the BeforeClose event.
Inside the BeforeClose event handler for this field, add code such as ...
cMailItem_BeforeClose(bool Cancel)
{
var Insp = cMailItem.GetInspector();
Insp.Close();
Marshal.FinalReleaseCOMObject(Insp);
Insp = null;
}
Then hopefully this will get rid of the shadow inspector.
I dont know if you are still working on with this problem or not, but I faced the exact same problem and then found the solution. You must be using the Ribbon designer just like I was. The ribbon designer cause this problem. I had to change from Ribbon designer to Ribbon XML. It was a little bit of work to remove code and change some logic, but that fixed the problem. I heard the other altenative is to use a wrapper class.
Hope this helps.
I am new to VSTO programming. I have created a basic addin for Outlook 2007 that monitors a folder containing XML text files which it opens and then sends them as an email, then deletes them. this all works fine.
I want the user to be able to configure certain settings for the way the addin/program will operate, such as the folder that it will monitor, and other things. The logical way to do this is to create a menu item in the addin (which I have also done) that opens a windows form (or XAML window) that allows them to enter the parameters.
In my addin I added a new item Windows Form, which worked, and the designer opened. However, in my addin code I cannot open the form. The Show() method normally associated with form objects is not available.
Is this simply something you cannot do, or am I just doing it the wrong way?
I have read about Outlook form regions, but these seemed to be attached to outlook items such as a new email, task, appointment etc... there doesnt seem to be a way to create a form region that can be opened in the main window of Outlook.
Ideally, I would like to go with my original method of opening a new window from a menu item, but if this isnt possible I would like to hear other solutions.
Thanks,
Will.
For a normal form, it sounds like you didn't just add System.Windows.Forms as a reference,
create the object then show it eg.
Form myFrm = new frmFlightList();
myFrm.Show();
This should work in a VSTO addin, as it does in any other form. The CMSConnectorControl object you refer to is a distraction to others for the general case of just wanting to display a form.
figured this out, After I built my form I just had to add these lines
CMSConnectorControl formMain = new CMSConnectorControl();
formMain.ShowDialog();
to the ThisAddin_Startup() function.