<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Office Development with Visual Studio : VS2008</title><link>http://blogs.msdn.com/vsto/archive/tags/VS2008/default.aspx</link><description>Tags: VS2008</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Making a Custom Group Appear in the Message Tab of a Mail Item (Norm Estabrook)</title><link>http://blogs.msdn.com/vsto/archive/2009/12/15/making-a-custom-group-appear-in-the-message-tab-of-a-mail-item-norm-estabrook.aspx</link><pubDate>Tue, 15 Dec 2009 22:14:38 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9937317</guid><dc:creator>VSTO Team</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/vsto/comments/9937317.aspx</comments><wfw:commentRss>http://blogs.msdn.com/vsto/commentrss.aspx?PostID=9937317</wfw:commentRss><description>&lt;p&gt;You can add a custom group to the &lt;strong&gt;Message&lt;/strong&gt; tab of an Outlook mail item.&amp;#160; For example, here is a custom group named &amp;quot;MyCoolGroup&amp;quot; that I added to the message tab of a new message:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/DisplayingaCustomGroupinBoththeOutlookMa_D2A0/image_9.png" mce_href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/DisplayingaCustomGroupinBoththeOutlookMa_D2A0/image_9.png"&gt;&lt;img style="border-right-width: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/DisplayingaCustomGroupinBoththeOutlookMa_D2A0/image_thumb_3.png" width="674" height="227" mce_src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/DisplayingaCustomGroupinBoththeOutlookMa_D2A0/image_thumb_3.png" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Outlook lets you open a message in the following two modes: &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Compose (you are drafting a new message). &lt;/li&gt;    &lt;li&gt;Read (you are reading a message).&amp;#160; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Making a custom group appear for only one of these modes is pretty easy.&amp;#160; Making it appear for both modes is a tad more challenging. That is because the control ID of the &lt;strong&gt;Message&lt;/strong&gt; tab in read mode is different than the control ID of the &lt;strong&gt;Message&lt;/strong&gt; tab in compose mode. When you design your custom group in the VSTO Ribbon designer, you can only specify &lt;strong&gt;one&lt;/strong&gt; control ID. This means that when you run the project, the custom group will only appear in the &lt;strong&gt;Message&lt;/strong&gt; tab of a compose window or the &lt;strong&gt;Message&lt;/strong&gt; tab of a read window depending on which control ID you specify at design-time. &lt;/p&gt;  &lt;p&gt;If you want the group to appear in both versions of the &lt;strong&gt;Message&lt;/strong&gt; tab (read and compose), you have to do a bit more work. Here is how you make the group appear for both modes:&lt;/p&gt;  &lt;p&gt;First, add a &lt;strong&gt;Ribbon (Visual Designer)&lt;/strong&gt; to an Outlook 2007 add-in project.&lt;/p&gt;  &lt;p&gt;Then, set the &lt;strong&gt;RibbonType&lt;/strong&gt; property of the Ribbon to &lt;strong&gt;Microsoft.Outlook.Mail.Read&lt;/strong&gt; as follows:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/DisplayingaCustomGroupinBoththeOutlookMa_D2A0/image_10.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/DisplayingaCustomGroupinBoththeOutlookMa_D2A0/image_thumb.png" width="283" height="393" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;On the Ribbon designer, add a group to a tab and customize the group as desired.&amp;#160; &lt;/p&gt;  &lt;p&gt;On the Ribbon designer, select the tab, open the &lt;strong&gt;Properties&lt;/strong&gt; window, and then set the &lt;strong&gt;OfficeId&lt;/strong&gt; of the tab to &lt;strong&gt;TabReadMessage&lt;/strong&gt;.&amp;#160; &lt;strong&gt;TabReadMessage&lt;/strong&gt; is the control ID of the default tab that appears on the Ribbon of a mail message that is open in read mode.&amp;#160; &lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/DisplayingaCustomGroupinBoththeOutlookMa_D2A0/image_7.png" mce_href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/DisplayingaCustomGroupinBoththeOutlookMa_D2A0/image_7.png"&gt;&lt;img style="border-right-width: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/DisplayingaCustomGroupinBoththeOutlookMa_D2A0/image_thumb_2.png" width="405" height="336" mce_src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/DisplayingaCustomGroupinBoththeOutlookMa_D2A0/image_thumb_2.png" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Ok. Now when you run the project, your custom group will appear only if you open a mail item in read mode. Now you need to add second Ribbon to your project to display this custom group in a mail item that is open in compose mode.&lt;/p&gt;  &lt;p&gt;Add a second &lt;strong&gt;Ribbon (Visual Designer)&lt;/strong&gt; to the project. Then, set the &lt;strong&gt;RibbonType&lt;/strong&gt; property of the Ribbon to &lt;strong&gt;Microsoft.Outlook.Mail.Compose&lt;/strong&gt; as follows:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/DisplayingaCustomGroupinBoththeOutlookMa_D2A0/image_12.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/DisplayingaCustomGroupinBoththeOutlookMa_D2A0/image_thumb_4.png" width="295" height="399" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;On the Ribbon designer, select the tab of the second Ribbon, open the &lt;strong&gt;Properties&lt;/strong&gt; window, and then set the &lt;strong&gt;OfficeId&lt;/strong&gt; of the tab to &lt;strong&gt;TabNewMailMessage&lt;/strong&gt;.&amp;#160; &lt;strong&gt;TabNewMailMessage&lt;/strong&gt; is the control ID of the default tab that appears on the Ribbon of a mail message that is open in compose mode.&amp;#160; &lt;/p&gt;  &lt;p&gt;I know what your thinking. Do you mean I have to create two separate custom groups? That defeats the whole point of trying to do this right?&amp;#160; Yes that would. Fortunately, you don’t have to create two custom groups. You only have to create two Ribbons as I have shown here. You can use the same custom group in both Ribbons.&amp;#160; Here is how:&lt;/p&gt;  &lt;p&gt;Open the first Ribbon that you created in the Ribbon Designer.&amp;#160; In the Ribbon Designer, select your custom group. In the &lt;strong&gt;Properties&lt;/strong&gt; window, set the &lt;strong&gt;Modifiers&lt;/strong&gt; property of the group to &lt;strong&gt;Public&lt;/strong&gt;.&lt;/p&gt;  &lt;p&gt;Open the code file of the second Ribbon that you created (called Ribbon2 in my project).&lt;/p&gt;  &lt;p&gt;In the constructor of the second Ribbon, add the custom group from Ribbon1 to Ribbon2 as follows: &lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;public &lt;/span&gt;Ribbon2()
{
    InitializeComponent();
    &lt;span style="color: #2b91af"&gt;Ribbon1 &lt;/span&gt;firstRibbon = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Ribbon1&lt;/span&gt;();
    &lt;span style="color: blue"&gt;this&lt;/span&gt;.tab1.Groups.Add(firstRibbon.group1);
}&lt;/pre&gt;

&lt;p&gt;You can read more about adding custom groups to built-in tabs in the following MSDN articles:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/bb608593.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/bb608593.aspx"&gt;How to: Customize a Built-in tab&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/bb608616.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/bb608616.aspx"&gt;How to: Get Started Customizing the Ribbon&lt;/a&gt;&lt;/p&gt;
&lt;a href="http://msdn2.microsoft.com/en-us/library/bb386089.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/bb386089.aspx"&gt;Ribbon Designer&lt;/a&gt; 

&lt;p&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/bb398246.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/bb398246.aspx"&gt;Customizing a Ribbon for Outlook&lt;/a&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9937317" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/vsto/archive/tags/Outlook+2007/default.aspx">Outlook 2007</category><category domain="http://blogs.msdn.com/vsto/archive/tags/VSTO/default.aspx">VSTO</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Norm+Estabrook/default.aspx">Norm Estabrook</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Ribbon/default.aspx">Ribbon</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Office+2007/default.aspx">Office 2007</category><category domain="http://blogs.msdn.com/vsto/archive/tags/VS2008/default.aspx">VS2008</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Office+Development/default.aspx">Office Development</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Office+2010/default.aspx">Office 2010</category></item><item><title>Office Development with Visual Studio 2008 Tutorial Series – Part 2(Beth Massi)</title><link>http://blogs.msdn.com/vsto/archive/2009/12/08/office-development-with-visual-studio-2008-tutorial-series-part-2-beth-massi.aspx</link><pubDate>Tue, 08 Dec 2009 18:36:03 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9934188</guid><dc:creator>VSTO Team</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/vsto/comments/9934188.aspx</comments><wfw:commentRss>http://blogs.msdn.com/vsto/commentrss.aspx?PostID=9934188</wfw:commentRss><description>&lt;p&gt;Last month &lt;a href="https://mvp.support.microsoft.com/profile=169AE602-45EF-47E6-8868-CA3E91D0A1EE"&gt;Robert Green&lt;/a&gt;, VSTO MVP, started a series of tutorials on building on Office 2007. Today we published part 2 of his step-by-step tutorials. &lt;/p&gt;  &lt;p&gt;In this second part of the series of tutorials on Office Business Applications, learn how to create a Word 2007 price quote generation solution using Visual Studio 2008. This tutorial shows you how to create a custom task pane to display data from a database and binding that data to content controls. This step-by-step tutorial also includes full source code in Visual Basic and C#. Check out the tutorial on the &lt;a href="http://msdn.microsoft.com/en-us/vsto/ee620548.aspx"&gt;VSTO Developer Center&lt;/a&gt;: &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;a href="http://msdn.microsoft.com/en-us/vsto/ee861194.aspx" target="_blank"&gt;Building an Office Business Application Part 2 – Generating Automobile Quotes&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;And if you missed part 1:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/vsto/ee620548.aspx" target="_blank"&gt;Building an Office Business Application Part 1 - Scheduling Customer Appointments&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;If you’re just getting started with Office development in Visual Studio, this is a great place to start.&lt;/p&gt;  &lt;p&gt;Enjoy,   &lt;br /&gt;-&lt;a href="http://blogs.msdn.com/bethmassi" target="_blank"&gt;Beth Massi&lt;/a&gt;, Visual Studio Community&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9934188" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/vsto/archive/tags/VSTO/default.aspx">VSTO</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Word+2007/default.aspx">Word 2007</category><category domain="http://blogs.msdn.com/vsto/archive/tags/OBA/default.aspx">OBA</category><category domain="http://blogs.msdn.com/vsto/archive/tags/VS2008/default.aspx">VS2008</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Beth+Massi/default.aspx">Beth Massi</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Community/default.aspx">Community</category></item><item><title>Office Development with Visual Studio 2008 Tutorial Series Started (Beth Massi)</title><link>http://blogs.msdn.com/vsto/archive/2009/10/14/office-development-with-visual-studio-2008-tutorial-series-started-beth-massi.aspx</link><pubDate>Wed, 14 Oct 2009 16:25:36 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9907229</guid><dc:creator>VSTO Team</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/vsto/comments/9907229.aspx</comments><wfw:commentRss>http://blogs.msdn.com/vsto/commentrss.aspx?PostID=9907229</wfw:commentRss><description>&lt;p&gt;&lt;a href="https://mvp.support.microsoft.com/profile=169AE602-45EF-47E6-8868-CA3E91D0A1EE" target="_blank"&gt;Robert Green&lt;/a&gt;, VSTO MVP, has started a series of tutorials on building on Office 2007! Thanks Robert!&amp;#160; &lt;/p&gt;  &lt;p&gt;In this first of a series of tutorials on building applications on Office you’ll learn how to create an Outlook 2007 customer appointment management solution using Visual Studio 2008. This step-by-step tutorial also includes full source code in Visual Basic and C#. Check out the tutorial on the &lt;a href="http://msdn.microsoft.com/en-us/vsto/ee620548.aspx" target="_blank"&gt;VSTO Developer Center&lt;/a&gt;:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://services.social.microsoft.com/feeds/FeedItem?feedId=146ffb4f-ecd0-4016-9e11-be93ec1694da&amp;amp;itemId=84011f83-b4ab-4647-a075-18a10f233142&amp;amp;title=Building+an+Office+Business+Application+Part+1+-+Scheduling+Customer+Appointments%0a&amp;amp;uri=http%3a%2f%2fmsdn.microsoft.com%2fen-us%2fvsto%2fee620548.aspx&amp;amp;k=3I27y%2fTfVojAFCTPmwvCjIgR0%2fw6dIWE5kj6v8CRqIU%3d"&gt;&lt;strong&gt;Building an Office Business Application Part 1 - Scheduling Customer Appointments &lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;If you’re just getting started with Office development in Visual Studio, this is a great place to start.&lt;/p&gt;  &lt;p&gt;Enjoy!&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9907229" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/vsto/archive/tags/Outlook+2007/default.aspx">Outlook 2007</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Office+2007/default.aspx">Office 2007</category><category domain="http://blogs.msdn.com/vsto/archive/tags/OBA/default.aspx">OBA</category><category domain="http://blogs.msdn.com/vsto/archive/tags/VS2008/default.aspx">VS2008</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Beth+Massi/default.aspx">Beth Massi</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Community/default.aspx">Community</category></item><item><title>Using Windows Presentation Foundation and Line-of-Business Data in Microsoft Office Clients (Beth Massi)</title><link>http://blogs.msdn.com/vsto/archive/2009/08/11/using-windows-presentation-foundation-and-line-of-business-data-in-microsoft-office-clients-beth-massi.aspx</link><pubDate>Wed, 12 Aug 2009 02:24:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9865164</guid><dc:creator>VSTO Team</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/vsto/comments/9865164.aspx</comments><wfw:commentRss>http://blogs.msdn.com/vsto/commentrss.aspx?PostID=9865164</wfw:commentRss><description>&lt;p&gt;I &lt;a href="http://blogs.msdn.com/bethmassi/archive/2009/08/10/using-windows-presentation-foundation-in-office-clients.aspx" target="_blank"&gt;mentioned on my blog yesterday&lt;/a&gt; that &lt;a href="http://www.sdn.nl/SDN/Magazine/tabid/66/articleType/ArticleView/articleId/2870/SDN-Magazine-101-Women-In-Technology-is-uit.aspx" target="_blank"&gt;SDN Magazine&lt;/a&gt; made an article I wrote back in May available online -- and since it’s all about using WPF &amp;amp; data in a VSTO solution I thought I’d post the link up here too :-)&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.sdn.nl/SDN/Artikelen/tabid/58/agentType/View/PropertyID/2982/Default.aspx"&gt;&lt;strong&gt;Using Windows Presentation Foundation and Line-of-Business Data in Microsoft Office Clients&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;In this article I talk about how to expose Line-of-Business data via ADO.NET Data Services to an Excel client using WPF. Office solutions you build with Visual Studio are designed to work with Windows Forms controls but you can also use WPF controls in your solutions as well. Any UI element that can host Windows Forms controls in an Office solution (VSTO) can also host WPF controls using the &lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.integration.elementhost.aspx"&gt;Winforms ElementHost&lt;/a&gt; as a container. &lt;/p&gt;  &lt;p&gt;Using WPF controls in Office allows you to think out of the box and provide world-class data visualizations that are not possible with Windows Forms controls. And you can do it easily in an instantly familiar end-user application like those in the Office family. But what if you don’t have any fancy data visualizations? Even the simplest controls that display data are often better off as WPF controls in Office applications because they better match the UI styles used in the latest versions of Office. Using WPF can make your add-ins look built into the Office applications themselves, providing a better user experience.&lt;/p&gt;  &lt;p&gt;This article describes one piece of the Northwind Office Business Application (OBA) sample we created in the beginning of the year so if you’re just getting started in OBA development with Outlook, Word, Excel and Sharepoint I’d suggest reading these as well:&lt;/p&gt;  &lt;li&gt;&lt;a href="http://blogs.msdn.com/bethmassi/archive/2009/02/03/oba-part-1-exposing-line-of-business-data.aspx"&gt;OBA Part 1 - Exposing Line-of-Business Data&lt;/a&gt;&lt;/li&gt;  &lt;li&gt;&lt;a href="http://blogs.msdn.com/bethmassi/archive/2009/02/07/oba-part-2-building-and-outlook-client-against-lob-data.aspx"&gt;OBA Part 2 - Building and Outlook Client against LOB Data&lt;/a&gt;&lt;/li&gt;  &lt;li&gt;&lt;a href="http://blogs.msdn.com/bethmassi/archive/2009/02/12/oba-part-3-storing-and-reading-data-in-word-documents.aspx"&gt;OBA Part 3 - Storing and Reading Data in Word Documents&lt;/a&gt;&lt;/li&gt;  &lt;li&gt;&lt;a href="http://blogs.msdn.com/bethmassi/archive/2009/03/08/oba-part-4-building-an-excel-client-against-lob-data.aspx"&gt;OBA Part 4 - Building an Excel Client against LOB Data&lt;/a&gt;&lt;/li&gt;  &lt;li&gt;&lt;a href="http://blogs.msdn.com/bethmassi/archive/2009/04/21/oba-part-5-building-the-sharepoint-2007-workflow.aspx"&gt;OBA Part 5 - Building the SharePoint 2007 Workflow&lt;/a&gt;&lt;/li&gt;  &lt;p&gt;The full sample application, built with Visual Studio 2008, is here: &lt;a href="http://code.msdn.microsoft.com/OBANorthwind"&gt;http://code.msdn.microsoft.com/OBANorthwind&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Hmm… I’m thinking a part 6 on deployment of this baby would be a good follow up….&lt;/p&gt;  &lt;p&gt;Enjoy,   &lt;br /&gt;-&lt;a href="http://blogs.msdn.com/bethmassi" target="_blank"&gt;Beth Massi&lt;/a&gt;, Visual Studio Community&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9865164" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/vsto/archive/tags/VSTO/default.aspx">VSTO</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Office+2007/default.aspx">Office 2007</category><category domain="http://blogs.msdn.com/vsto/archive/tags/sample/default.aspx">sample</category><category domain="http://blogs.msdn.com/vsto/archive/tags/OBA/default.aspx">OBA</category><category domain="http://blogs.msdn.com/vsto/archive/tags/VS2008/default.aspx">VS2008</category><category domain="http://blogs.msdn.com/vsto/archive/tags/WPF/default.aspx">WPF</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Beth+Massi/default.aspx">Beth Massi</category></item><item><title>Do Your Outlook UI Elements Need Counseling? - Get your Form Regions, Ribbons, and Task Panes Talking to Each Other Again (Norm Estabrook)</title><link>http://blogs.msdn.com/vsto/archive/2009/06/03/do-your-outlook-ui-elements-need-counseling-get-your-form-regions-ribbons-and-task-panes-talking-to-each-other-again-norm-estabrook.aspx</link><pubDate>Thu, 04 Jun 2009 01:30:31 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9693769</guid><dc:creator>VSTO Team</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/vsto/comments/9693769.aspx</comments><wfw:commentRss>http://blogs.msdn.com/vsto/commentrss.aspx?PostID=9693769</wfw:commentRss><description>&lt;p&gt;So you want to open a task pane by using a button on the Ribbon. You also want a form region that appears in an e-mail item to detect the state of a control on a custom task pane so that you can add or remove an option that appears in a Ribbon menu right? Ok, I completely made this scenario up. But at some point, somewhere along the way, you might say to yourself – how do I get to that gallery on my Ribbon from my task pane? or how do I enable the user to populate that combo box on the form region by selecting a control on the Ribbon? Well if that describes something that you are trying to do, then this post is for you. Let’s start with Ribbons. The other two (form regions and task panes) are bit more troublesome.&lt;/p&gt;  &lt;h4&gt;Ribbons&lt;/h4&gt;  &lt;p&gt;Ribbon controls are the easiest to access from other areas of your application. Assuming that your custom Ribbon is named &lt;em&gt;Ribbon1&lt;/em&gt;, here is what you do:&lt;/p&gt;  &lt;p align="left"&gt;&lt;span style="color: #2b91af"&gt;ThisRibbonCollection &lt;/span&gt;ribbonCollection =    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #2b91af"&gt;Globals&lt;/span&gt;.Ribbons    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; [&lt;span style="color: #2b91af"&gt;Globals&lt;/span&gt;.ThisAddIn.Application.ActiveInspector()];    &lt;br /&gt;ribbonCollection.Ribbon1.comboBox1.Text = &lt;span style="color: #a31515"&gt;&amp;quot;Hello World&amp;quot;&lt;/span&gt;;&lt;/p&gt;  &lt;p&gt;You can read more about this &lt;a href="http://msdn.microsoft.com/en-us/library/bb772088.aspx"&gt;here&lt;/a&gt;.&lt;/p&gt;  &lt;h4&gt;Form Regions&lt;/h4&gt;  &lt;p&gt;For the VB folks, this is a snap. C# developers have to do a bit more work. That is because by default, in a C# project, the controls that you add to a form region are private. For each control that you want to access, you have to set the &lt;strong&gt;Modifiers&lt;/strong&gt; property of the control to &lt;strong&gt;Internal &lt;/strong&gt;or &lt;strong&gt;Public&lt;/strong&gt;. For example: &lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/OutlookUICounselingGetyourFormRegionsRib_E1EA/image_2.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/OutlookUICounselingGetyourFormRegionsRib_E1EA/image_thumb.png" width="321" height="360" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;You can then add code to access the control. For example, assuming that your form region is named &lt;em&gt;FormRegion1&lt;/em&gt;, you could use the following code:&lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="color: #2b91af"&gt;WindowFormRegionCollection &lt;/span&gt;formRegions =
    &lt;span style="color: #2b91af"&gt;Globals&lt;/span&gt;.FormRegions
        [&lt;span style="color: #2b91af"&gt;Globals&lt;/span&gt;.ThisAddIn.Application.ActiveInspector()];
formRegions.FormRegion1.textBox1.Text = &lt;span style="color: #a31515"&gt;&amp;quot;Hello World&amp;quot;&lt;/span&gt;;&lt;/pre&gt;

&lt;p&gt;You can read more about this &lt;a href="http://msdn.microsoft.com/en-us/library/bb772084.aspx"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h4&gt;Custom Task Panes&lt;/h4&gt;

&lt;p&gt;Controls on task panes require the same tweaks described for form regions above.&amp;#160; Here is an example of how to get to a button on a task pane. This example makes the following assumptions:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;The user control of the custom task pane is named &lt;em&gt;MyUserControl&lt;/em&gt;. &lt;/li&gt;

  &lt;li&gt;The task pane is named &lt;em&gt;myCustomTaskPane&lt;/em&gt; and it is declared as public in your code.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;((&lt;span style="color: #2b91af"&gt;MyUserControl&lt;/span&gt;)&lt;span style="color: #2b91af"&gt;Globals&lt;/span&gt;.ThisAddIn.myCustomTaskPane.Control).button1.Text = &lt;span style="color: #a31515"&gt;&amp;quot;It Worked&amp;quot;&lt;/span&gt;;&lt;/p&gt;

&lt;p&gt;If have not yet created a custom task pane, see &lt;a href="http://msdn.microsoft.com/en-us/library/aa942846.aspx"&gt;this topic&lt;/a&gt; and it will all make sense.&lt;/p&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;As a side note, if you are adding custom task panes to Outlook Inspector windows, you have to write a bit of code to map each Inspector window with it’s own instance of a custom task pane. If you don’t do this mapping, you get all kinds of wacky issues.&amp;#160; For an example of how to do this, see the following &lt;a href="http://msdn.microsoft.com/en-us/library/bb296010.aspx"&gt;article&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;For the sake of being thorough, here is an example of how you can access a task pane created by using the guidance in that &lt;a href="http://msdn.microsoft.com/en-us/library/bb296010.aspx"&gt;article&lt;/a&gt;.&amp;#160; &lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;private void &lt;/span&gt;toggleButton1_Click(&lt;span style="color: blue"&gt;object &lt;/span&gt;sender, &lt;span style="color: #2b91af"&gt;RibbonControlEventArgs &lt;/span&gt;e)
{
    Outlook.&lt;span style="color: #2b91af"&gt;Inspector &lt;/span&gt;inspector = (Outlook.&lt;span style="color: #2b91af"&gt;Inspector&lt;/span&gt;)e.Control.Context;
    &lt;span style="color: #2b91af"&gt;InspectorWrapper &lt;/span&gt;inspectorWrapper = &lt;span style="color: #2b91af"&gt;Globals&lt;/span&gt;.ThisAddIn.InspectorWrappers[inspector];
    &lt;span style="color: #2b91af"&gt;CustomTaskPane &lt;/span&gt;taskPane = inspectorWrapper.CustomTaskPane;
    &lt;span style="color: blue"&gt;if &lt;/span&gt;(taskPane != &lt;span style="color: blue"&gt;null&lt;/span&gt;)
    {
        taskPane.Visible = ((&lt;span style="color: #2b91af"&gt;RibbonToggleButton&lt;/span&gt;)sender).Checked;
        taskPane.DockPosition = Microsoft.Office.Core.&lt;span style="color: #2b91af"&gt;MsoCTPDockPosition&lt;/span&gt;.msoCTPDockPositionBottom;
        taskPane.Height = 475;
    }
}&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;Hope this helps!&lt;/p&gt;

&lt;p&gt;Norm E.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9693769" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/vsto/archive/tags/Outlook+2007/default.aspx">Outlook 2007</category><category domain="http://blogs.msdn.com/vsto/archive/tags/VSTO/default.aspx">VSTO</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Norm+Estabrook/default.aspx">Norm Estabrook</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Ribbon/default.aspx">Ribbon</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Office+2007/default.aspx">Office 2007</category><category domain="http://blogs.msdn.com/vsto/archive/tags/VS2008/default.aspx">VS2008</category><category domain="http://blogs.msdn.com/vsto/archive/tags/add-ins/default.aspx">add-ins</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Office+Development/default.aspx">Office Development</category></item><item><title>VSTO Bug Tracker (Eric Carter, Beth Massi)</title><link>http://blogs.msdn.com/vsto/archive/2009/05/18/vsto-bug-tracker-eric-carter-beth-massi.aspx</link><pubDate>Mon, 18 May 2009 23:16:30 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9625928</guid><dc:creator>VSTO Team</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/vsto/comments/9625928.aspx</comments><wfw:commentRss>http://blogs.msdn.com/vsto/commentrss.aspx?PostID=9625928</wfw:commentRss><description>&lt;p&gt;&lt;a href="http://blogs.msdn.com/eric_carter/" target="_blank"&gt;Eric Carter&lt;/a&gt; released &lt;a href="http://code.msdn.microsoft.com/VSTOBugTracker" target="_blank"&gt;a sample and series of articles&lt;/a&gt; based on his TechEd demo last week that shows you how to bring bug data from TFS into Excel and Word using VSTO so it can be further analyzed. &lt;/p&gt;  &lt;p&gt;If you you went to TechEd but missed the session you can watch it here if you’ve registered:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.msteched.com/online/view.aspx?tid=2f9f0f7f-f546-4465-a618-744bff15d0b0"&gt;Advanced Microsoft Office Word and Excel 2007 Development in Microsoft Visual Studio 2008 with Visual Studio Tools for Office&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://code.msdn.microsoft.com/VSTOBugTracker" target="_blank"&gt;&lt;strong&gt;Everyone can download the sample here.&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;And don’t forget to check the &lt;a href="http://msdn.com/vsto" target="_blank"&gt;VSTO Dev Center&lt;/a&gt; often for more news, &lt;a href="http://msdn.microsoft.com/en-us/vsto/dd164305.aspx" target="_blank"&gt;articles&lt;/a&gt;, &lt;a href="http://msdn.microsoft.com/en-us/vsto/dd164303.aspx" target="_blank"&gt;videos&lt;/a&gt;, and samples.&lt;/p&gt;  &lt;p&gt;Enjoy,   &lt;br /&gt;-&lt;a href="http://blogs.msdn.com/bethmassi" target="_blank"&gt;Beth Massi&lt;/a&gt;, Visual Studio Community&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9625928" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/vsto/archive/tags/VSTO/default.aspx">VSTO</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Word+2007/default.aspx">Word 2007</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Excel+2007/default.aspx">Excel 2007</category><category domain="http://blogs.msdn.com/vsto/archive/tags/sample/default.aspx">sample</category><category domain="http://blogs.msdn.com/vsto/archive/tags/VS2008/default.aspx">VS2008</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Beth+Massi/default.aspx">Beth Massi</category></item><item><title>TechEd Sessions on Office Development</title><link>http://blogs.msdn.com/vsto/archive/2009/05/07/teched-sessions-on-office-development.aspx</link><pubDate>Fri, 08 May 2009 00:16:02 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9594976</guid><dc:creator>VSTO Team</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/vsto/comments/9594976.aspx</comments><wfw:commentRss>http://blogs.msdn.com/vsto/commentrss.aspx?PostID=9594976</wfw:commentRss><description>&lt;p&gt;If you’re going to TechEd in Los Angeles next week, then don’t miss these four sessions:&lt;/p&gt;  &lt;p&gt;&lt;b&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;   &lt;br /&gt;&lt;b&gt;DTL03-INT Meet the Microsoft Visual Studio Team&lt;/b&gt;     &lt;br /&gt;Christin Boyd, &lt;a href="http://blogs.msdn.com/eric_carter/default.aspx" target="_blank"&gt;Eric Carter&lt;/a&gt;, Paul Yuknewicz, Jay Schmelzer, &lt;a href="http://diditwith.net/" target="_blank"&gt;Dustin Campbell&lt;/a&gt;, Jonathan Aneja, &lt;a href="http://blogs.msdn.com/lukeh/" target="_blank"&gt;Luke Hoban&lt;/a&gt;, Igor Zinkovsky, Faisal Nasir, &lt;a href="http://devhawk.net/" target="_blank"&gt;Harry Pierson&lt;/a&gt;, &lt;a href="http://blogs.msdn.com/vbteam/" target="_blank"&gt;Lisa Feigenbaum&lt;/a&gt;     &lt;br /&gt;Mon 5/11&amp;#160; 2:45 PM-4:00 PM | Blue Theater 1     &lt;br /&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;OFC325&amp;#160; Building Custom Applications in Microsoft Office Outlook 2007&lt;/strong&gt;     &lt;br /&gt;&lt;a href="http://officedeveloper.net/" target="_blank"&gt;Ty Anderson&lt;/a&gt;, Damon Armstrong     &lt;br /&gt;Tue 5/12&amp;#160; 2:45 PM-4:00 PM | Room 408A&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;DTL324 - Microsoft Visual Studio 2010 Overview for the Business Application Developer &lt;/strong&gt;    &lt;br /&gt;Jay Schmelzer     &lt;br /&gt;Tue 5/12 4:30 PM-5:45 PM | Room 515B&lt;/p&gt;  &lt;p&gt;&lt;b&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;OFC324&lt;/b&gt;     &lt;br /&gt;&lt;b&gt;Advanced Microsoft Office Word and Excel 2007 Development in Microsoft Visual Studio 2008 with Visual Studio Tools for Office&lt;/b&gt;     &lt;br /&gt;&lt;a href="http://blogs.msdn.com/eric_carter/default.aspx" target="_blank"&gt;Eric Carter&lt;/a&gt;     &lt;br /&gt;Thursday 5/14 1:00PM-2:15PM | Room 515A&lt;/p&gt;  &lt;p&gt;Of course, there are a dozen other sessions that appeal to Office developers and SharePoint developers.&amp;#160; These are the four that I highly recommend.&amp;#160; Originally I was going to list the 3 not-to-be-missed sessions, but then I couldn’t drop any of these from my list, so we have 4 Must See Sessions!&amp;#160; &lt;/p&gt;  &lt;p&gt;If you’re not going to TechEd, then please click the links on these speakers’ names to read their blogs where the will eventually post some of their demo code.&amp;#160; Expect the posts to happen the Monday after their sessions.&amp;#160; In the case of Eric Carter, he would probably love it if you’d buy his book, &lt;a href="http://www.amazon.com/Visual-Studio-Tools-Office-2007/dp/0321533216" target="_blank"&gt;Visual Studio Tools for Office 2007: VSTO for Excel, Word and Outlook&lt;/a&gt;&lt;u&gt;&lt;/u&gt;.&amp;#160; Or you could just download a zip file with all of the of code from the book &lt;a href="http://blogs.msdn.com/eric_carter/archive/2009/03/14/visual-studio-tools-for-office-2007-code-listings.aspx" target="_blank"&gt;here&lt;/a&gt;.&amp;#160; That should keep you busy for a while.&amp;#160; The explanations in the book really do add to the overall value.&amp;#160; I should credit the co-author, Eric Lippert.&amp;#160; Both men are brilliant and funny, and very modest.&amp;#160; At the Holiday Party this year, Eric Carter got up to sing karaoke and astounded us all with a bouncy rendition of “Sesame Street.” &lt;/p&gt;  &lt;p&gt;-Christin Boyd, Program Manager, Visual Studio&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9594976" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/vsto/archive/tags/Outlook+2007/default.aspx">Outlook 2007</category><category domain="http://blogs.msdn.com/vsto/archive/tags/VSTO/default.aspx">VSTO</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Christin+Boyd/default.aspx">Christin Boyd</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Office+2007/default.aspx">Office 2007</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Word+2007/default.aspx">Word 2007</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Excel+2007/default.aspx">Excel 2007</category><category domain="http://blogs.msdn.com/vsto/archive/tags/VB/default.aspx">VB</category><category domain="http://blogs.msdn.com/vsto/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://blogs.msdn.com/vsto/archive/tags/VS2008/default.aspx">VS2008</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Community/default.aspx">Community</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Office+Development/default.aspx">Office Development</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Visual+Studio+2010/default.aspx">Visual Studio 2010</category></item><item><title>Issues with installing VSTO projects that were published from Visual Studio 2008 on Windows 7 RC (Saurabh Bhatia)</title><link>http://blogs.msdn.com/vsto/archive/2009/05/07/issues-with-installing-vsto-projects-that-were-published-from-visual-studio-2008-on-windows-7-rc-saurabh-bhatia.aspx</link><pubDate>Thu, 07 May 2009 23:32:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9594863</guid><dc:creator>VSTO Team</dc:creator><slash:comments>8</slash:comments><comments>http://blogs.msdn.com/vsto/comments/9594863.aspx</comments><wfw:commentRss>http://blogs.msdn.com/vsto/commentrss.aspx?PostID=9594863</wfw:commentRss><description>&lt;P&gt;Many customers have reported issues with installing a VSTO project that has been published with Visual Studio 2008 running on the recently released Windows 7 Release Candidate.&lt;/P&gt;
&lt;P&gt;If you published your solution using VS2008 on a machine running the Windows 7 RC and then you try to install the solution on any machine you will see the following error: “The required version of the .NET Framework is not installed on this computer”&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/IssueswithinstallingVSTOprojectsthatwere_BE50/image_2.png" mce_href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/IssueswithinstallingVSTOprojectsthatwere_BE50/image_2.png"&gt;&lt;IMG style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: block; FLOAT: none; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; MARGIN-LEFT: auto; BORDER-LEFT-WIDTH: 0px; MARGIN-RIGHT: auto" title=image border=0 alt=image src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/IssueswithinstallingVSTOprojectsthatwere_BE50/image_thumb.png" width=421 height=480 mce_src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/IssueswithinstallingVSTOprojectsthatwere_BE50/image_thumb.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;You will see this error even if you have the right version of .Net Framework installed. The issue occurs due to some differences in the publishing mechanism on the Windows 7 RC caused by a missing file in the .Net Framework 3.5.1 which was included in the RC.&lt;/P&gt;
&lt;P&gt;The following file is missing:&lt;/P&gt;
&lt;P&gt;&lt;FONT size=3 face=Consolas&gt;%ProgramFiles%\Reference Assemblies\Microsoft\Framework\v3.5\RedistList\FrameworkList.xml&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;You can workaround the issue by manually copying this file from an existing non Windows 7 machine which has the .Net Framework 3.5 installed. The file will be available at the exact same location.&lt;/P&gt;
&lt;P&gt;Once you have included this file on the Windows 7 RC machine, you will be able to publish and generate the correct manifests. After making this change please republish any solutions that were previously published from the Windows 7 RC machine. These solutions will now be able to install successfully.&lt;/P&gt;
&lt;P&gt;We are tracking this issue and plan to address it before Windows 7 RTM. If you are using the RC release please use the workaround mentioned above.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Updates**********&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;If you have having trouble replacing the file. You need to be an Owner of the file and your user account needs Full Control.&amp;nbsp; To do this: &lt;/P&gt;
&lt;P&gt;•&amp;nbsp;&amp;nbsp;&amp;nbsp; Right click the File -&amp;gt; Properties &lt;BR&gt;•&amp;nbsp;&amp;nbsp;&amp;nbsp; Select Security Tab &lt;BR&gt;•&amp;nbsp;&amp;nbsp;&amp;nbsp; Click the Advanced Button &lt;BR&gt;•&amp;nbsp;&amp;nbsp;&amp;nbsp; Click the “Owner” Tab &lt;BR&gt;•&amp;nbsp;&amp;nbsp;&amp;nbsp; Click the Change Button &lt;BR&gt;•&amp;nbsp;&amp;nbsp;&amp;nbsp; Double Click your User Object &lt;BR&gt;•&amp;nbsp;&amp;nbsp;&amp;nbsp; Click Okay &lt;BR&gt;•&amp;nbsp;&amp;nbsp;&amp;nbsp; Click Okay, &lt;BR&gt;•&amp;nbsp;&amp;nbsp;&amp;nbsp; Ensure you have “Full Control” Permissions to the file by repeating steps above and adding your user account with Full Control permissions. &lt;/P&gt;
&lt;P&gt;Also if you are on a 64 bit system:&lt;/P&gt;
&lt;P&gt;Note that you need to replace both the architecture specific files on a 64bit bit OS, i.e. &lt;BR&gt;[Program Files x86]\Reference Assemblies\Microsoft\Framework\v3.5\RedistList &lt;BR&gt;%ProgramFiles%\Reference Assemblies\Microsoft\Framework\v3.5\RedistList&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9594863" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/vsto/archive/tags/ClickOnce/default.aspx">ClickOnce</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Deployment/default.aspx">Deployment</category><category domain="http://blogs.msdn.com/vsto/archive/tags/VS2008/default.aspx">VS2008</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Saurabh+Bhatia/default.aspx">Saurabh Bhatia</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Windows+7+RC/default.aspx">Windows 7 RC</category></item><item><title>Here is a Way to Get the ID of a Built-in Outlook Command Bar Menu (Norm Estabrook)</title><link>http://blogs.msdn.com/vsto/archive/2009/04/30/here-is-a-way-to-get-the-id-of-a-built-in-outlook-command-bar-menu-norm-estabrook.aspx</link><pubDate>Fri, 01 May 2009 00:09:27 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9581289</guid><dc:creator>VSTO Team</dc:creator><slash:comments>6</slash:comments><comments>http://blogs.msdn.com/vsto/comments/9581289.aspx</comments><wfw:commentRss>http://blogs.msdn.com/vsto/commentrss.aspx?PostID=9581289</wfw:commentRss><description>&lt;p&gt;Recently, a &lt;a href="http://social.msdn.microsoft.com/Forums/en-US/vsto/thread/adee1998-d619-4667-b08c-5038d02c3a0b/?prof=required"&gt;forum poster&lt;/a&gt; asked us how he could add a submenu item to a built-in menu item in Outlook.&amp;#160; Note that these are not controls that appear on the Ribbon of an Outlook item, but rather the menus that drop down from the top of the Outlook Explorer such as the &lt;strong&gt;View&lt;/strong&gt; menu and the &lt;strong&gt;Tools&lt;/strong&gt; menu.&lt;/p&gt;  &lt;p&gt;So one way to do this (In fact the only way that I know of) is to use the example shown in the following MSDN topic - &lt;a href="http://msdn.microsoft.com/en-us/library/ms269110.aspx"&gt;How to: Add Custom Menus and Menu Items to Outlook&lt;/a&gt;. &lt;/p&gt;  &lt;p&gt;You can’t just use the example as is. You will need to add a line of code to get a handle to a built-in menu. The following example gets a handle to the &lt;strong&gt;Junk E-Mail&lt;/strong&gt; menu that appears off of the &lt;strong&gt;Actions&lt;/strong&gt; menu of the Outlook Explorer window.&lt;/p&gt;  &lt;p&gt;Office.&lt;span style="color: #2b91af"&gt;CommandBarPopup &lt;/span&gt;junkEmailMenu = (Office.&lt;span style="color: #2b91af"&gt;CommandBarPopup&lt;/span&gt;)    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;this&lt;/span&gt;.Application.ActiveExplorer().CommandBars.FindControl    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; (Office.&lt;span style="color: #2b91af"&gt;MsoControlType&lt;/span&gt;.msoControlPopup, &lt;strong&gt;31353&lt;/strong&gt;, missing, missing);&lt;/p&gt;  &lt;p&gt;Note the ID number shown in the second parameter to the FindControl method. How on earth did I know that the &lt;strong&gt;Junk E-Mail&lt;/strong&gt; menu is the &lt;strong&gt;31353&lt;/strong&gt; menu?&amp;#160; The answer is … Not very easily. In fact to obtain that ID, I wrote a small Outlook add-in that iterates through all menus in Outlook and prints out their corresponding codes.&amp;#160; I figured that I would share this with you in case you ever have a similar scenario.&lt;/p&gt;  &lt;p&gt;Two notes about the sample below: First - this is a C# example, so my apologies to VB’ers. Second - this example is meant to be used in a Visual Studio 2008 Outlook (2007 or 2003) add-in project.&amp;#160; These projects automatically include the appropriate using statements that enable you to use the prefix “Office” in place of “Microsoft.Office.Core” when referring to some objects etc.&lt;/p&gt;  &lt;p&gt;Ok. Here is the code:&lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;public partial class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;ThisAddIn
&lt;/span&gt;{
    &lt;span style="color: blue"&gt;private void &lt;/span&gt;ThisAddIn_Startup(&lt;span style="color: blue"&gt;object &lt;/span&gt;sender, System.&lt;span style="color: #2b91af"&gt;EventArgs &lt;/span&gt;e)
    {
        Outlook.&lt;span style="color: #2b91af"&gt;Application &lt;/span&gt;app = &lt;span style="color: blue"&gt;this&lt;/span&gt;.Application;
        &lt;span style="color: green"&gt;//Create a new txt file to record controls' list

        &lt;/span&gt;System.IO.&lt;span style="color: #2b91af"&gt;StreamWriter &lt;/span&gt;sw = System.IO.&lt;span style="color: #2b91af"&gt;File&lt;/span&gt;.CreateText
            (&lt;span style="color: #a31515"&gt;@&amp;quot;C:\Outlook Menus.txt&amp;quot;&lt;/span&gt;);

        &lt;span style="color: green"&gt;//loop through Outlook ActiveExplorer CommandBars to get all CommandBars

        &lt;/span&gt;&lt;span style="color: blue"&gt;foreach &lt;/span&gt;(Office.&lt;span style="color: #2b91af"&gt;CommandBarControl &lt;/span&gt;cb &lt;span style="color: blue"&gt;in &lt;/span&gt;app.ActiveExplorer().CommandBars.ActiveMenuBar.Controls)
        {
            PrintMenuItems(cb, sw);
        }

        sw.Close();

    }

    &lt;span style="color: green"&gt;// Recursive method for printing menus and nested menus.
    // Either the menu is a commandbarpopup (contains submenus)
    // Or it is a commandbarbutton (contains no submenus)

    &lt;/span&gt;&lt;span style="color: blue"&gt;private void &lt;/span&gt;PrintMenuItems(&lt;span style="color: blue"&gt;object &lt;/span&gt;menuItem, System.IO.&lt;span style="color: #2b91af"&gt;StreamWriter &lt;/span&gt;sw)
    {
        &lt;span style="color: blue"&gt;if &lt;/span&gt;(menuItem &lt;span style="color: blue"&gt;as &lt;/span&gt;Office.&lt;span style="color: #2b91af"&gt;CommandBarButton &lt;/span&gt;== &lt;span style="color: blue"&gt;null&lt;/span&gt;)
        {
            &lt;span style="color: green"&gt;// This is a menu bar popup control.
            &lt;/span&gt;sw.WriteLine((menuItem &lt;span style="color: blue"&gt;as &lt;/span&gt;Office.&lt;span style="color: #2b91af"&gt;CommandBarPopup&lt;/span&gt;).Caption +
                &lt;span style="color: #a31515"&gt;&amp;quot;\t&amp;quot; &lt;/span&gt;+ (menuItem &lt;span style="color: blue"&gt;as &lt;/span&gt;Office.&lt;span style="color: #2b91af"&gt;CommandBarPopup&lt;/span&gt;).Id.ToString());

            &lt;span style="color: blue"&gt;if &lt;/span&gt;((menuItem &lt;span style="color: blue"&gt;as &lt;/span&gt;Office.&lt;span style="color: #2b91af"&gt;CommandBarPopup&lt;/span&gt;).accChildCount &amp;gt; 0)
            {
                &lt;span style="color: blue"&gt;for &lt;/span&gt;(&lt;span style="color: blue"&gt;int &lt;/span&gt;j = 1; j &amp;lt;= (menuItem &lt;span style="color: blue"&gt;as &lt;/span&gt;Office.&lt;span style="color: #2b91af"&gt;CommandBarPopup&lt;/span&gt;).accChildCount; j++)
                {
                    PrintMenuItems((menuItem &lt;span style="color: blue"&gt;as &lt;/span&gt;Office.&lt;span style="color: #2b91af"&gt;CommandBarPopup&lt;/span&gt;).get_accChild(j), sw);
                }
            }
        }
        &lt;span style="color: blue"&gt;else
        &lt;/span&gt;{
            &lt;span style="color: green"&gt;// Must be a command
            &lt;/span&gt;sw.WriteLine(&lt;span style="color: #a31515"&gt;&amp;quot;\t&amp;quot; &lt;/span&gt;+ (menuItem &lt;span style="color: blue"&gt;as &lt;/span&gt;Office.&lt;span style="color: #2b91af"&gt;CommandBarControl&lt;/span&gt;).Caption +
                &lt;span style="color: #a31515"&gt;&amp;quot;\t&amp;quot; &lt;/span&gt;+ (menuItem &lt;span style="color: blue"&gt;as &lt;/span&gt;Office.&lt;span style="color: #2b91af"&gt;CommandBarControl&lt;/span&gt;).Id.ToString());
        }

    }&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;Enjoy!&lt;/p&gt;

&lt;p&gt;Norm E.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9581289" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/vsto/archive/tags/Outlook+2007/default.aspx">Outlook 2007</category><category domain="http://blogs.msdn.com/vsto/archive/tags/VSTO/default.aspx">VSTO</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Norm+Estabrook/default.aspx">Norm Estabrook</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Command+bars/default.aspx">Command bars</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Office+2007/default.aspx">Office 2007</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Office+2003/default.aspx">Office 2003</category><category domain="http://blogs.msdn.com/vsto/archive/tags/VS2008/default.aspx">VS2008</category><category domain="http://blogs.msdn.com/vsto/archive/tags/add-ins/default.aspx">add-ins</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Office+Development/default.aspx">Office Development</category></item><item><title>Clearing Off Custom Menu Items in Word (Norm Estabrook)</title><link>http://blogs.msdn.com/vsto/archive/2009/04/14/clearing-off-custom-menu-items-in-word-norm-estabrook.aspx</link><pubDate>Tue, 14 Apr 2009 21:37:15 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9548974</guid><dc:creator>VSTO Team</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/vsto/comments/9548974.aspx</comments><wfw:commentRss>http://blogs.msdn.com/vsto/commentrss.aspx?PostID=9548974</wfw:commentRss><description>&lt;p&gt;Last month I posted &lt;a href="http://blogs.msdn.com/vsto/archive/2009/03/06/my-word-add-in-creates-duplicate-menu-items-make-it-stop-norm-estabrook.aspx"&gt;this article&lt;/a&gt; that described how to prevent your add-in from creating duplicate menu items in Word.&amp;#160; If you have been experimenting with customization contexts, you might have several menu items that appear when you right click a document. The article that I posted shows how to prevent this from happening for your users, but what about removing the items that appear in your instance of Word – the one that you use for testing? &lt;/p&gt;  &lt;p&gt;To clear those off, just add a bit of code to the startup event handler of any old Word add-in.&amp;#160; Set the customization context to each possible culprit (template, document, attached template etc.) and then call the &lt;strong&gt;Reset&lt;/strong&gt; method. Be sure to save the template or document after words.&amp;#160; &lt;/p&gt;  &lt;p&gt;Note - I wouldn’t recommend that you put this code into an add-in that you send out to users as this code will remove all customizations in each context (Even ones that your add-in has not created!).&amp;#160; However, it is a cool way to clear up left over menu items from the instance of Word that you use for testing.&lt;/p&gt;  &lt;p&gt;&lt;span style="color: blue"&gt;private void &lt;/span&gt;ResetShortcutMenu()     &lt;br /&gt;{     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; myApplication.CustomizationContext = myApplication.ActiveDocument;     &lt;br /&gt;    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; myApplication.CommandBars[&lt;span style="color: #a31515"&gt;&amp;quot;Text&amp;quot;&lt;/span&gt;].Reset();     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; myApplication.ActiveDocument.Save();     &lt;br /&gt;    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; myApplication.CustomizationContext = myApplication.ActiveDocument.get_AttachedTemplate();     &lt;br /&gt;    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; myApplication.CommandBars[&lt;span style="color: #a31515"&gt;&amp;quot;Text&amp;quot;&lt;/span&gt;].Reset();     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; ((Word.&lt;span style="color: #2b91af"&gt;Template&lt;/span&gt;)myApplication.ActiveDocument.get_AttachedTemplate()).Save();     &lt;br /&gt;    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; myApplication.CustomizationContext = customTemplate;     &lt;br /&gt;    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; myApplication.CommandBars[&lt;span style="color: #a31515"&gt;&amp;quot;Text&amp;quot;&lt;/span&gt;].Reset();     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; customTemplate.Save();     &lt;br /&gt;    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; myApplication.CustomizationContext = myApplication.NormalTemplate;     &lt;br /&gt;    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; myApplication.CommandBars[&lt;span style="color: #a31515"&gt;&amp;quot;Text&amp;quot;&lt;/span&gt;].Reset();     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; myApplication.NormalTemplate.Save();     &lt;br /&gt;}&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9548974" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/vsto/archive/tags/VSTO/default.aspx">VSTO</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Norm+Estabrook/default.aspx">Norm Estabrook</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Office+2007/default.aspx">Office 2007</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Office+2003/default.aspx">Office 2003</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Word+Object+Model/default.aspx">Word Object Model</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Word+2007/default.aspx">Word 2007</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Word+2003/default.aspx">Word 2003</category><category domain="http://blogs.msdn.com/vsto/archive/tags/VS2008/default.aspx">VS2008</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Office+Development/default.aspx">Office Development</category></item><item><title>Channel 9 Interview: Resigning ClickOnce Application and Deployment Manifests with MAGE (Beth Massi, Saurabh Bhatia)</title><link>http://blogs.msdn.com/vsto/archive/2009/04/08/channel-9-interview-resigning-clickonce-application-and-deployment-manifests-with-mage-beth-massi-saurabh-bhatia.aspx</link><pubDate>Wed, 08 Apr 2009 18:25:33 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9538393</guid><dc:creator>VSTO Team</dc:creator><slash:comments>4</slash:comments><comments>http://blogs.msdn.com/vsto/comments/9538393.aspx</comments><wfw:commentRss>http://blogs.msdn.com/vsto/commentrss.aspx?PostID=9538393</wfw:commentRss><description>&lt;p&gt;&lt;a href="http://channel9.msdn.com/posts/funkyonex/Resigning-ClickOnce-Application-and-Deployment-Manifests-with-MAGE/" target="_blank"&gt;I just posted another interview on Channel 9&lt;/a&gt;. I sit down again with Saurabh Bhatia, a Program Manager on the Office Client team, who is responsible for the ClickOnce publishing functionality in Visual Studio. We chat about trust issues and certificates and he sets me straight on how ClickOnce deployment and application manifests work. He then shows how to resign them outside of Visual Studio using a tool called &lt;a href="http://msdn.microsoft.com/en-us/library/acz3y3te.aspx"&gt;Mage&lt;/a&gt;. This is really handy for folks that need to modify the files within a deployment package, like the application settings (app.config) file, but don't have Visual Studio installed. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://channel9.msdn.com/posts/funkyonex/Resigning-ClickOnce-Application-and-Deployment-Manifests-with-MAGE/"&gt;&lt;strong&gt;Channel 9: Resigning ClickOnce Application and Deployment Manifests with MAGE&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Saurabh draws on the whiteboard in this one and since I'm a one (wo)man show I couldn't jump up and zoom in so I redrew it for you all here. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/photos/bethmassi/images/9537238/original.aspx"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" src="http://blogs.msdn.com/photos/bethmassi/images/9537238/500x177.aspx" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Links from the show:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/acz3y3te.aspx"&gt;Mage&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blogs.msdn.com/vsto"&gt;Office Client (VSTO) Team blog (you are here ;-))&lt;/a&gt;      &lt;li&gt;&lt;/li&gt;     &lt;a href="http://msdn.com/vsto"&gt;VSTO Developer Center&lt;/a&gt; &lt;/a&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Enjoy,   &lt;br /&gt;-&lt;a href="http://blogs.msdn.com/bethmassi"&gt;Beth Massi&lt;/a&gt;, Visual Studio Community&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9538393" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/vsto/archive/tags/ClickOnce/default.aspx">ClickOnce</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Deployment/default.aspx">Deployment</category><category domain="http://blogs.msdn.com/vsto/archive/tags/VS2008/default.aspx">VS2008</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Saurabh+Bhatia/default.aspx">Saurabh Bhatia</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Beth+Massi/default.aspx">Beth Massi</category></item><item><title>Video How Do I: Add Controls at Run Time in an Application-Level Project (Mary Lee)</title><link>http://blogs.msdn.com/vsto/archive/2009/03/10/video-how-do-i-add-controls-at-run-time-in-an-application-level-project-mary-lee.aspx</link><pubDate>Tue, 10 Mar 2009 18:59:52 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9469226</guid><dc:creator>VSTO Team</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/vsto/comments/9469226.aspx</comments><wfw:commentRss>http://blogs.msdn.com/vsto/commentrss.aspx?PostID=9469226</wfw:commentRss><description>&lt;p&gt;In &lt;a href="http://msdn.microsoft.com/en-us/library/cc442817.aspx"&gt;Walkthrough: Adding Controls to a Worksheet at Run Time in an Application-Level Project&lt;/a&gt;, you can see&amp;#160; to add host controls at run time in an application-level add-in by using Visual Studio 2008 SP1.&amp;#160; This video is posted to the &lt;a href="http://msdn.microsoft.com/en-us/vbasic/bb466226.aspx"&gt;How Do I Videos - Visual Basic&lt;/a&gt; page, part of the Visual Basic Developer Center.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/vbasic/dd551271.aspx"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="240" alt="image" src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/VideoHowDoIAddControlsatRunTimeinanAppli_A36A/image_3.png" width="300" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/vbasic/dd551271.aspx"&gt;How Do I: Add Controls to a Worksheet at Run Time in an Application-Level Project?&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Mary Lee, Programming Writer.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9469226" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/vsto/archive/tags/VSTO/default.aspx">VSTO</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Mary+Lee/default.aspx">Mary Lee</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Office+2007/default.aspx">Office 2007</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Excel+2007/default.aspx">Excel 2007</category><category domain="http://blogs.msdn.com/vsto/archive/tags/VS2008/default.aspx">VS2008</category><category domain="http://blogs.msdn.com/vsto/archive/tags/SP1/default.aspx">SP1</category></item><item><title>Building Office Business Applications with Visual Studio</title><link>http://blogs.msdn.com/vsto/archive/2009/02/03/building-office-business-applications-with-visual-studio.aspx</link><pubDate>Tue, 03 Feb 2009 22:01:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9393614</guid><dc:creator>VSTO Team</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/vsto/comments/9393614.aspx</comments><wfw:commentRss>http://blogs.msdn.com/vsto/commentrss.aspx?PostID=9393614</wfw:commentRss><description>&lt;FONT size=2&gt;
&lt;P&gt;This week Microsoft is hosting an internal even called Tech Ready 8 in Seattle.&amp;nbsp;&amp;nbsp;Microsoft technical field reps and product teams come together to talk about&amp;nbsp;all of the great products we're building.&amp;nbsp; I presented a session on Building Office Development Applications with Visual Studio along with a couple team members.&amp;nbsp; In preparation for that session we spent the past week building a demo application that surfaces LOB data exposed as an ADO .NET dataservices in Outlook and Excel clients and SharePoint.&amp;nbsp; Beth Massi is doing a blog series on how we wrote the soloution.&amp;nbsp; &lt;A href="http://blogs.msdn.com/bethmassi/archive/tags/OBA/default.aspx" target=_blank mce_href="http://blogs.msdn.com/bethmassi/archive/tags/OBA/default.aspx"&gt;Check it out.&amp;nbsp;&lt;/A&gt; &lt;/P&gt;&lt;/FONT&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9393614" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/vsto/archive/tags/OBA/default.aspx">OBA</category><category domain="http://blogs.msdn.com/vsto/archive/tags/VS2008/default.aspx">VS2008</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Beth+Massi/default.aspx">Beth Massi</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Office+Development/default.aspx">Office Development</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Rachel+Schaw/default.aspx">Rachel Schaw</category></item><item><title>Making a Custom Ribbon Appear Only for a Custom Outlook Form (Norm Estabrook)</title><link>http://blogs.msdn.com/vsto/archive/2009/01/28/making-a-custom-ribbon-appear-only-for-a-custom-outlook-form.aspx</link><pubDate>Wed, 28 Jan 2009 23:09:46 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9381689</guid><dc:creator>VSTO Team</dc:creator><slash:comments>4</slash:comments><comments>http://blogs.msdn.com/vsto/comments/9381689.aspx</comments><wfw:commentRss>http://blogs.msdn.com/vsto/commentrss.aspx?PostID=9381689</wfw:commentRss><description>&lt;p&gt;Many of you have posted questions to the &lt;a href="http://social.msdn.microsoft.com/forums/en-US/vsto/threads/"&gt;VSTO Forum&lt;/a&gt; about how to make custom tabs, groups and controls appear only in cases where the user opens a custom form in Outlook. &lt;/p&gt;  &lt;p&gt;The reason why that is difficult to accomplish is because there is no way to specify the names of custom forms in the Ribbon Designer. You can only specify inspector window types.&lt;/p&gt;  &lt;p&gt;So if I set the &lt;a href="http://msdn.microsoft.com/en-us/library/microsoft.office.tools.ribbon.officeribbon.ribbontype.aspx"&gt;RibbonType&lt;/a&gt; property of the Ribbon to “Microsoft.Outlook.Mail.Compose”,&amp;#160; then the Ribbon controls appear for all new mail items &lt;strong&gt;including&lt;/strong&gt; items that I create by using a custom mail form. So how can I make sure that the Ribbon controls only appear in my custom mail form? &lt;/p&gt;  &lt;p&gt;One possible workaround is to show and hide controls based on the message class of an Outlook form. It seemed to work for me and here is how I did it.&lt;/p&gt;  &lt;p&gt;In the Ribbon designer, set the &lt;strong&gt;Visible&lt;/strong&gt; property of your custom controls to false. At this point, those controls will not appear in any Outlook form custom or otherwise.&lt;/p&gt;  &lt;p&gt;Next, add a property to the ThisAddIn class that stores the name of a custom message class as follows:&lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;private string &lt;/span&gt;strMessageClass = &lt;span style="color: #a31515"&gt;&amp;quot;&amp;quot;&lt;/span&gt;;
&lt;span style="color: blue"&gt;public string &lt;/span&gt;MessageClass
{
    &lt;span style="color: blue"&gt;get
    &lt;/span&gt;{
        &lt;span style="color: blue"&gt;return &lt;/span&gt;strMessageClass;
    }
    &lt;span style="color: blue"&gt;set
    &lt;/span&gt;{
        strMessageClass = &lt;span style="color: blue"&gt;value&lt;/span&gt;;
    }
}&lt;/pre&gt;

&lt;p&gt;Create an event handler for the &lt;a href="http://msdn.microsoft.com/en-us/library/microsoft.office.interop.outlook.inspectorsevents_newinspectoreventhandler.aspx"&gt;NewInspector&lt;/a&gt; event. This event is raised every time a new Outlook inspector is open. The item that opens in the inspector has a message class name. For example, if you open a standard mail item, the message class name of the item is “IPM.Note”. A custom form based on a standard email form might have the message class name “IPM.Note.MyCustomForm”.&lt;/p&gt;

&lt;p&gt;In the event handler, set your custom string property to the message class name of the open item. Here is an example:&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;private &lt;/span&gt;Outlook.&lt;span style="color: #2b91af"&gt;Inspectors &lt;/span&gt;inspectors;
&lt;span style="color: blue"&gt;private void &lt;/span&gt;ThisAddIn_Startup(&lt;span style="color: blue"&gt;object &lt;/span&gt;sender, System.&lt;span style="color: #2b91af"&gt;EventArgs &lt;/span&gt;e)
{
    inspectors = &lt;span style="color: blue"&gt;this&lt;/span&gt;.Application.Inspectors;
    inspectors.NewInspector +=
        &lt;span style="color: blue"&gt;new &lt;/span&gt;Microsoft.Office.Interop.Outlook.&lt;span style="color: #2b91af"&gt;InspectorsEvents_NewInspectorEventHandler
            &lt;/span&gt;(Inspectors_NewInspector);

}

&lt;span style="color: blue"&gt;void &lt;/span&gt;Inspectors_NewInspector(Microsoft.Office.Interop.Outlook.&lt;span style="color: #2b91af"&gt;Inspector &lt;/span&gt;Inspector)
{
    Outlook.&lt;span style="color: #2b91af"&gt;MailItem &lt;/span&gt;tmpMailItem = (Outlook.&lt;span style="color: #2b91af"&gt;MailItem&lt;/span&gt;)Inspector.CurrentItem;
    &lt;span style="color: blue"&gt;if &lt;/span&gt;(tmpMailItem != &lt;span style="color: blue"&gt;null&lt;/span&gt;)
        MessageClass = tmpMailItem.MessageClass;
}&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;In the load event of your Ribbon class, check your custom string property to determine the message class of the item that is attempting to load your custom Ribbon. If the name matches the name of your custom message class, you can show the controls on your custom Ribbon. Here is an example:&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;private void &lt;/span&gt;Ribbon1_Load(&lt;span style="color: blue"&gt;object &lt;/span&gt;sender, &lt;span style="color: #2b91af"&gt;RibbonUIEventArgs &lt;/span&gt;e)
{
    &lt;span style="color: blue"&gt;if &lt;/span&gt;(&lt;span style="color: #2b91af"&gt;Globals&lt;/span&gt;.ThisAddIn.MessageClass == &lt;span style="color: #a31515"&gt;&amp;quot;IPM.Note.Norm&amp;quot;&lt;/span&gt;)
    {
        group1.Visible = &lt;span style="color: blue"&gt;true&lt;/span&gt;;
        &lt;span style="color: #2b91af"&gt;Globals&lt;/span&gt;.ThisAddIn.MessageClass = &lt;span style="color: #a31515"&gt;&amp;quot;&amp;quot;&lt;/span&gt;;
    }
    

}&lt;/pre&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9381689" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/vsto/archive/tags/Outlook+2007/default.aspx">Outlook 2007</category><category domain="http://blogs.msdn.com/vsto/archive/tags/VSTO/default.aspx">VSTO</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Norm+Estabrook/default.aspx">Norm Estabrook</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Ribbon/default.aspx">Ribbon</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Office+2007/default.aspx">Office 2007</category><category domain="http://blogs.msdn.com/vsto/archive/tags/VS2008/default.aspx">VS2008</category></item><item><title>Setting the Width of a Drop Down, Combo Box, or Edit Box in the Ribbon Designer (Norm Estabrook)</title><link>http://blogs.msdn.com/vsto/archive/2008/12/19/setting-the-width-of-a-drop-down-combo-box-or-edit-box-in-the-ribbon-designer.aspx</link><pubDate>Fri, 19 Dec 2008 21:56:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9242650</guid><dc:creator>VSTO Team</dc:creator><slash:comments>4</slash:comments><comments>http://blogs.msdn.com/vsto/comments/9242650.aspx</comments><wfw:commentRss>http://blogs.msdn.com/vsto/commentrss.aspx?PostID=9242650</wfw:commentRss><description>&lt;P&gt;Recently, a developer posted a question to the &lt;A href="http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=1018&amp;amp;SiteID=1" mce_href="http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=1018&amp;amp;SiteID=1"&gt;VSTO forum&lt;/A&gt; asking us how to set the width of a drop down control by using the Ribbon Designer (&lt;A href="http://social.msdn.microsoft.com/Forums/en-US/vsto/thread/8965ae5a-9c02-4aec-9178-675650b7044e/" mce_href="http://social.msdn.microsoft.com/Forums/en-US/vsto/thread/8965ae5a-9c02-4aec-9178-675650b7044e/"&gt;http://social.msdn.microsoft.com/Forums/en-US/vsto/thread/8965ae5a-9c02-4aec-9178-675650b7044e/&lt;/A&gt;).&lt;/P&gt;
&lt;P&gt;As this person experienced, if you do not set the width of the control, the text that appears in a drop down, combo box, or edit box will truncate. For example, the string “I love Visual Studio Tools for Office!” is truncated in the following drop down:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/SettingtheWidthofaDropDownComboBoxorEdit_99C4/clip_image002_2.jpg" mce_href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/SettingtheWidthofaDropDownComboBoxorEdit_99C4/clip_image002_2.jpg"&gt;&lt;IMG title=clip_image002 style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; DISPLAY: inline; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=191 alt=clip_image002 src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/SettingtheWidthofaDropDownComboBoxorEdit_99C4/clip_image002_thumb.jpg" width=238 border=0 mce_src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/SettingtheWidthofaDropDownComboBoxorEdit_99C4/clip_image002_thumb.jpg"&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;So how do you fix this? The magic lies in the &lt;A href="http://msdn.microsoft.com/en-us/library/microsoft.office.tools.ribbon.ribbondropdown.sizestring.aspx" mce_href="http://msdn.microsoft.com/en-us/library/microsoft.office.tools.ribbon.ribbondropdown.sizestring.aspx"&gt;SizeString&lt;/A&gt;&lt;B&gt; &lt;/B&gt;property. However, the use of this property is not so obvious. Instead of setting this property to a number such as &lt;B&gt;20 &lt;/B&gt;for 20 characters of space, you must type an actual character for each character’s worth of space you want to allocate for the text width. &lt;/P&gt;
&lt;P&gt;For example, to make enough space for the string “I love Visual Studio Tools for Office!”, set the &lt;A href="http://msdn.microsoft.com/en-us/library/microsoft.office.tools.ribbon.ribbondropdown.sizestring.aspx" mce_href="http://msdn.microsoft.com/en-us/library/microsoft.office.tools.ribbon.ribbondropdown.sizestring.aspx"&gt;SizeString&lt;/A&gt; property of the drop down to “xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx” or “jlkjlkjlkjlkjdlslaledfoplklksjjklsfdf” etc. &lt;/P&gt;
&lt;P&gt;You can also decrease the size of the text area to show fewer characters than appear by default. For example, just set &lt;A href="http://msdn.microsoft.com/en-us/library/microsoft.office.tools.ribbon.ribbondropdown.sizestring.aspx" mce_href="http://msdn.microsoft.com/en-us/library/microsoft.office.tools.ribbon.ribbondropdown.sizestring.aspx"&gt;SizeString&lt;/A&gt; to “xx” if you want only two characters to appear. &lt;/P&gt;
&lt;P&gt;Norm E.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9242650" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/vsto/archive/tags/VSTO/default.aspx">VSTO</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Norm+Estabrook/default.aspx">Norm Estabrook</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Ribbon/default.aspx">Ribbon</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Office+2007/default.aspx">Office 2007</category><category domain="http://blogs.msdn.com/vsto/archive/tags/VS2008/default.aspx">VS2008</category></item></channel></rss>