<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>Anil Kumar's Office 2010 &amp; Open Xml Blog</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/anilkumar/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/anilkumar/feed.xml</link>
    <description />
    <lastBuildDate>Wed, 17 Apr 2019 03:39:42 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>How to create a VSTO add-in for PowerPoint to insert charts with External Data using the Business Connectivity Services API.</title>
      <link>https://docs.microsoft.com/archive/blogs/anilkumar/how-to-create-a-vsto-add-in-for-powerpoint-to-insert-charts-with-external-data-using-the-business-connectivity-services-api</link>
      <pubDate>Fri, 20 Aug 2010 02:06:00 GMT</pubDate>
      <dc:creator><![CDATA[AnilKumar_bhaskara]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/anilkumar/2010/08/20/how-to-create-a-vsto-add-in-for-powerpoint-to-insert-charts-with-external-data-using-the-business-connectivity-services-api/</guid>
      <description><![CDATA[&nbsp;

&nbsp;
Summary
It is a common scenario to use charts in the PowerPoint presentation...]]></description>
      <content:encoded><![CDATA[<p><span style="font-family: Verdana;"><span style="font-size: x-small;"></span></span></p>
<p><span style="font-size: large;"><span style="color: #365f91;"><span style="font-family: Cambria;"><strong><o:p></o:p><span style="LINE-HEIGHT: 115%; COLOR: black; FONT-SIZE: 10pt; FONT-WEIGHT: normal; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana"><w:sdtpr></w:sdtpr></span></strong></span></span></span></p>
<p>&nbsp;</p>
<p><span style="font-family: Verdana;"><span style="font-size: x-small;"></span></span>
<p>&nbsp;</p>
<p class="Text"><span style="font-family: Verdana;"><span style="font-size: x-small;"><strong>Summary</strong></span></span></p>
<p class="Text"><span style="font-family: Verdana;"><span style="font-size: x-small;">It is a common scenario to use charts in the PowerPoint presentation as a way of summarizing the data in and make it more readable and actionable. Frequently, the data used to generate the charts will often reside in an external system such as a database, CRM or an ERP system. This involves switching between the applications and is often time consuming in the getting the data. Also it may be desirable to get the up-to-date information on such charts.<o:p></o:p></span></span></p>
<p class="Text"><span style="font-size: x-small;"><span style="font-family: Verdana;">For example, many sales departments need to report sales figures in a regular weekly or monthly meeting.<span style="mso-spacerun: yes;">&nbsp; </span>Typically this would be presented as a chart in a PowerPoint presentation. This data is often stored in an external database. The sales manager can use the add-in to create the chart and the add-in will in turn use the BCS API to get the data<span class="MsoCommentReference"><span style="font-family: 'Verdana','sans-serif';">. We can develop the PowerPoint add-in using Visual Studio 2010. </span></span>This add-in will connect to the back-end data using Business Connectivity Services (BCS), a set of capabilities that ship as part of Office and SharePoint 2010.Following sections explain how to develop this add in.<o:p></o:p></span></span></p>
<p class="Text"><b style="mso-bidi-font-weight: normal;"><span style="font-size: x-small;"><span style="font-family: Verdana;"><span style="mso-spacerun: yes;">&nbsp;</span>Important Note:<o:p></o:p></span></span></b></p>
<p class="Text"><span style="font-size: x-small;"><span style="font-family: Verdana;"><span style="background: yellow; mso-highlight: yellow;">I co-wrote this article with <b style="mso-bidi-font-weight: normal;">Eric White</b> .Many thanks to him for providing the insights. Many thanks to <b style="mso-bidi-font-weight: normal;">Brad Stevenson, Juan Balmori Labra , Russell Palmer and Thomas Mechelke</b></span><b style="mso-bidi-font-weight: normal;"> </b><span style="background: yellow; mso-highlight: yellow;">for reviewing this article. They are the program managers behind the article.</span> <o:p></o:p></span></span></p>
<p class="Text"><span style="font-size: x-small;"><span style="font-family: Verdana;">This article will be published on MSDN some time.<o:p></o:p></span></span></p>
<p class="Text">&nbsp;</p>
<p><span style="font-size: x-small;"><span style="font-family: Verdana;"></span></span></p>
<p>&nbsp;</p>
<h1 style="MARGIN: 9pt 0in 3pt">About the sample</h1>
<p class="MsoNormal"><span style="font-size: x-small;"><span style="font-family: Verdana;">The sample in the article is a PowerPoint add-in. If you follow the steps mentioned in this document you will be creating an add-in that would insert the new slide and the chart. This chart will use the data that is fetched using the BCS API to get the data. This data is stored in the SQL Server. To make the example simple we will use the data from the &ldquo;SalesTerritory&rdquo; table. This table contains the sales data across various territories in the United States. <o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="font-size: x-small;"><span style="font-family: Verdana;">This add-in contains a ribbon tab &ldquo;BCS&rdquo; which has a button &ldquo;Add External Data to Chart&rdquo;.<span style="mso-spacerun: yes;">&nbsp; </span><o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="font-size: x-small;"><span style="font-family: Verdana;">When the user clicks on this button, the add-in will open the custom task pane.<o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="font-size: x-small;"><span style="font-family: Verdana;">This custom task pane is populated with the external content types available in the business connectivity services cache. It uses the BCS client object model to get the data from the external system.<span style="mso-spacerun: yes;">&nbsp; </span><o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="font-size: x-small;"><span style="font-family: Verdana;">When you click on the button &ldquo;Insert Chart&rdquo; it will insert the new slide and the chart by using the values selected in the custom task pane and inserts it in the new slide like this.<o:p></o:p></span></span></p>
<p>&nbsp;</p>
<p class="MsoNormal"><span style="font-size: x-small;"><span style="font-family: Verdana;"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/33/30/0825.ScreenShot.jpg" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-30/0825.ScreenShot.jpg" border="0" />Finally you will use the BCS Solution Package Tool to package and deploy the solution to ensure that the metadata model is available to the client before invoking the BCS runtime APIs.<o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="font-family: Verdana; font-size: x-small;">The following section describes how to generate such a chart.</span></p>
<p><span style="mso-bookmark: _Toc244344249;"></span><span style="mso-bookmark: _Toc244342781;"></span></p>
<h1>&nbsp;Generating Chart in PowerPoint Add-in</h1>
<p class="MsoNormal"><span style="font-family: Verdana; font-size: x-small;">In Office 2010, there is a chart object. The chart object mainly surfaces a chart on the slide and renders a graph with the supplied values. For more information about the chart object, see MSDN blog post, </span><a href="https://blogs.msdn.com/excel/archive/2009/08/18/chart-object-model-in-word-powerpoint.aspx"><span style="font-family: Verdana; color: #0000ff; font-size: x-small;">Chart Object</span></a><span style="font-family: Verdana;"><span style="font-size: x-small;">.<o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="font-family: Verdana;"><span style="font-size: x-small;">In our sample each chart draws the trend of &ldquo;Last Year Sales&rdquo; to &ldquo;Year to Date Sales&rdquo; using the following lines of code.<o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="font-family: Verdana;"><span style="font-size: x-small;"><span style="mso-spacerun: yes;">&nbsp;</span><o:p></o:p></span></span></p>
<p class="Code"><span style="font-size: x-small;"><span style="font-family: Courier New;">public void InsertChart(ChartDataObject chartDataObject)<o:p></o:p></span></span></p>
<p class="Code"><span style="font-size: x-small;"><span style="font-family: Courier New;">{<o:p></o:p></span></span></p>
<p class="Code"><span style="font-size: x-small;"><span style="font-family: Courier New;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp; </span>Chart chart = null;<o:p></o:p></span></span></p>
<p class="Code"><span style="font-size: x-small;"><span style="font-family: Courier New;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp; </span>Shape shape = null;<o:p></o:p></span></span></p>
<p class="Code"><span style="font-size: x-small;"><span style="font-family: Courier New;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp; </span>Microsoft.Office.Interop.Excel.Workbook Workbook = null;<o:p></o:p></span></span></p>
<p class="Code"><span style="font-size: x-small;"><span style="font-family: Courier New;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp; </span>Microsoft.Office.Interop.Excel.Application Application = null;<o:p></o:p></span></span></p>
<p class="Code"><span style="font-size: x-small;"><span style="font-family: Courier New;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp; </span>try<o:p></o:p></span></span></p>
<p class="Code"><span style="font-size: x-small;"><span style="font-family: Courier New;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp; </span>{<o:p></o:p></span></span></p>
<p class="Code"><span style="font-size: x-small;"><span style="font-family: Courier New;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>//Add the new slide<o:p></o:p></span></span></p>
<p class="Code"><span style="font-size: x-small;"><span style="font-family: Courier New;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>Slide slide = this.Application.ActivePresentation.Slides.Add(this.Application.ActivePresentation.Slides.Count + 1, PpSlideLayout.ppLayoutChart);<o:p></o:p></span></span></p>
<p class="Code"><span style="font-size: x-small;"><span style="font-family: Courier New;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>//Insert the chart<o:p></o:p></span></span></p>
<p class="Code"><span style="font-size: x-small;"><span style="font-family: Courier New;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>shape = slide.Shapes.AddChart(Office.XlChartType.xlLine);<o:p></o:p></span></span></p>
<p class="Code"><span style="font-size: x-small;"><span style="font-family: Courier New;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>chart = shape.Chart;<o:p></o:p></span></span></p>
<p class="Code"><span style="font-size: x-small;"><span style="font-family: Courier New;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>//Clear the chart contents<o:p></o:p></span></span></p>
<p class="Code"><span style="font-size: x-small;"><span style="font-family: Courier New;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>chart.ChartArea.ClearContents();<o:p></o:p></span></span></p>
<p class="Code"><span style="font-size: x-small;"><span style="font-family: Courier New;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>object[] Values = new object[chartDataObject.XValues.Count()];<o:p></o:p></span></span></p>
<p class="Code"><o:p><span style="font-family: Courier New; font-size: x-small;">&nbsp;</span></o:p></p>
<p class="Code"><span style="font-size: x-small;"><span style="font-family: Courier New;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>for (int i = 0; i &lt; chartDataObject.Data.Rows.Count; i++)<o:p></o:p></span></span></p>
<p class="Code"><span style="font-size: x-small;"><span style="font-family: Courier New;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>{<o:p></o:p></span></span></p>
<p class="Code"><span style="font-size: x-small;"><span style="font-family: Courier New;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>for (int j = 0; j &lt; chartDataObject.XValues.Length; j++)<o:p></o:p></span></span></p>
<p class="Code"><span style="font-size: x-small;"><span style="font-family: Courier New;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>{<o:p></o:p></span></span></p>
<p class="Code"><span style="font-size: x-small;"><span style="font-family: Courier New;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>Values[j] = chartDataObject.Data.Rows[i][chartDataObject.XValues[j].ToString()];<o:p></o:p></span></span></p>
<p class="Code"><span style="font-size: x-small;"><span style="font-family: Courier New;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>}<o:p></o:p></span></span></p>
<p class="Code"><span style="font-size: x-small;"><span style="font-family: Courier New;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>SeriesCollection SeriesCollection = chart.SeriesCollection() as SeriesCollection;<o:p></o:p></span></span></p>
<p class="Code"><span style="font-size: x-small;"><span style="font-family: Courier New;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>//Create new series based on the data<o:p></o:p></span></span></p>
<p class="Code"><span style="font-size: x-small;"><span style="font-family: Courier New;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>Series Series = SeriesCollection.NewSeries();<o:p></o:p></span></span></p>
<p class="Code"><span style="font-size: x-small;"><span style="font-family: Courier New;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>Series.Name = chartDataObject.Data.Rows[i][chartDataObject.SeriesName].ToString();<o:p></o:p></span></span></p>
<p class="Code"><span style="font-size: x-small;"><span style="font-family: Courier New;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>Series.XValues = chartDataObject.XValues;<o:p></o:p></span></span></p>
<p class="Code"><span style="font-size: x-small;"><span style="font-family: Courier New;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>Series.Values = Values;<o:p></o:p></span></span></p>
<p class="Code"><span style="font-size: x-small;"><span style="font-family: Courier New;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>}<o:p></o:p></span></span></p>
<p class="Code"><span style="font-size: x-small;"><span style="font-family: Courier New;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>//Activate the chart to refresh with the fresh data.<o:p></o:p></span></span></p>
<p class="Code"><span style="font-size: x-small;"><span style="font-family: Courier New;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>chart.ChartData.Activate();<o:p></o:p></span></span></p>
<p class="Code"><span style="font-size: x-small;"><span style="font-family: Courier New;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp; </span>}<o:p></o:p></span></span></p>
<p class="Code"><span style="font-size: x-small;"><span style="font-family: Courier New;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp; </span>finally<o:p></o:p></span></span></p>
<p class="Code"><span style="font-size: x-small;"><span style="font-family: Courier New;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp; </span>{<o:p></o:p></span></span></p>
<p class="Code"><span style="font-size: x-small;"><span style="font-family: Courier New;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>//Close the Excel Workbook and clean up resources.<o:p></o:p></span></span></p>
<p class="Code"><span style="font-size: x-small;"><span style="font-family: Courier New;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>if (chart != null &amp;&amp; chart.ChartData != null)<o:p></o:p></span></span></p>
<p class="Code"><span style="font-size: x-small;"><span style="font-family: Courier New;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>{<o:p></o:p></span></span></p>
<p class="Code"><span style="font-size: x-small;"><span style="font-family: Courier New;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>Workbook = chart.ChartData.Workbook as Microsoft.Office.Interop.Excel.Workbook;<o:p></o:p></span></span></p>
<p class="Code"><span style="font-size: x-small;"><span style="font-family: Courier New;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>if (Workbook != null)<o:p></o:p></span></span></p>
<p class="Code"><span style="font-size: x-small;"><span style="font-family: Courier New;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>Application = Workbook.Application;<o:p></o:p></span></span></p>
<p class="Code"><span style="font-size: x-small;"><span style="font-family: Courier New;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>if (Application != null &amp;&amp; Workbook!=null)<o:p></o:p></span></span></p>
<p class="Code"><span style="font-size: x-small;"><span style="font-family: Courier New;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>{<o:p></o:p></span></span></p>
<p class="Code"><span style="font-size: x-small;"><span style="font-family: Courier New;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>//Quit Excel Application<o:p></o:p></span></span></p>
<p class="Code"><span style="font-size: x-small;"><span style="font-family: Courier New;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>Application.Quit();<o:p></o:p></span></span></p>
<p class="Code"><span style="font-size: x-small;"><span style="font-family: Courier New;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>Application = null;<o:p></o:p></span></span></p>
<p class="Code"><span style="font-size: x-small;"><span style="font-family: Courier New;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>Workbook = null;<o:p></o:p></span></span></p>
<p class="Code"><span style="font-size: x-small;"><span style="font-family: Courier New;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>//Force the GC, this is recommended for releasing the resources. <o:p></o:p></span></span></p>
<p class="Code"><span style="font-size: x-small;"><span style="font-family: Courier New;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>//Quitting Excel doesnt ensure resources are cleaned immediatly<o:p></o:p></span></span></p>
<p class="Code"><span style="font-size: x-small;"><span style="font-family: Courier New;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>GC.Collect();<o:p></o:p></span></span></p>
<p class="Code"><span style="font-size: x-small;"><span style="font-family: Courier New;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>GC.WaitForPendingFinalizers();<o:p></o:p></span></span></p>
<p class="Code"><span style="font-size: x-small;"><span style="font-family: Courier New;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>//Repeated calls is necessary is because the memory for the Excel <o:p></o:p></span></span></p>
<p class="Code"><span style="font-size: x-small;"><span style="font-family: Courier New;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>//would have survived for the first pass.<o:p></o:p></span></span></p>
<p class="Code"><span style="font-size: x-small;"><span style="font-family: Courier New;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>//Hence the second try to recalim completely.<o:p></o:p></span></span></p>
<p class="Code"><span style="font-size: x-small;"><span style="font-family: Courier New;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>GC.Collect();<o:p></o:p></span></span></p>
<p class="Code"><span style="font-size: x-small;"><span style="font-family: Courier New;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>GC.WaitForPendingFinalizers();<o:p></o:p></span></span></p>
<p class="Code"><span style="font-size: x-small;"><span style="font-family: Courier New;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>}<o:p></o:p></span></span></p>
<p class="Code"><span style="font-size: x-small;"><span style="font-family: Courier New;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>}<o:p></o:p></span></span></p>
<p class="Code"><span style="font-size: x-small;"><span style="font-family: Courier New;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp; </span>}<o:p></o:p></span></span></p>
<p class="Code"><span style="font-size: x-small;"><span style="font-family: Courier New;">}<o:p></o:p></span></span></p>
<p class="Code"><o:p><span style="font-family: Courier New; font-size: x-small;">&nbsp;</span></o:p></p>
<p><span style="font-family: 'Verdana','sans-serif'; color: black; font-size: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;">The add in will use BCS to get the data for the chart. Following section provides an overview of BCS.</span></p>
<p><span style="font-family: 'Verdana','sans-serif'; color: black; font-size: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"></span>&nbsp;</p>
<h1 style="MARGIN: 9pt 0in 3pt"><span style="mso-bookmark: _Toc262160948"></span><span style="mso-bookmark: _Toc260278139"></span><span style="FONT-WEIGHT: normal"><o:p><strong>Overview of BCS</strong></o:p></span></h1>
<p class="MsoNormal">Business Connectivity Services (BCS) in SharePoint 2010 is the successor of Business Data Catalog that is available in MOSS 2007, with Enterprise Client Access License. It has rich designer capabilities.<span style="mso-spacerun: yes;">&nbsp; </span><o:p></o:p></p>
<p class="MsoNormal">For more information about the overview of BCS, see MSDN documentation <a href="https://msdn.microsoft.com/en-us/library/ee557898(v=office.14).aspx"><span style="color: #0000ff;">Overview of Business Connectivity Services</span></a>. Integration with Office add-ins applications is much simpler. <o:p></o:p></p>
<p class="MsoNormal">The following figure shows the high level architecture of BCS.<o:p></o:p></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p class="MsoNormal"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/33/30/0005.BCSArchitecture.jpg" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-30/0005.BCSArchitecture.jpg" border="0" />BCS is all about connecting to external data.<span style="mso-spacerun: yes;">&nbsp; </span>This external data can be viewed in the SharePoint list, Word, Outlook and SharePoint Workspace out of the box without any additional work. If you want to build a custom Word or Outlook solution, or surface the external data in applications that are not supported out of the box such as Excel or PowerPoint application, you can code against the BCS client runtime.<o:p></o:p></p>
<p class="MsoNormal">Following are the important components in BCS that you need to understand.<o:p></o:p></p>
<p class="MsoListParagraphCxSpFirst"><span style="line-height: 115%; font-family: Symbol; color: black; font-size: 10pt; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol;"><span style="mso-list: Ignore;">&middot;<span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><span style="line-height: 115%; font-family: 'Verdana','sans-serif'; color: black; font-size: 10pt; mso-fareast-font-family: 'Times New Roman';">External Content Type<o:p></o:p></span></p>
<p class="MsoListParagraphCxSpMiddle"><span lang="ES-MX" style="line-height: 115%; font-family: Symbol; color: black; font-size: 10pt; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol; mso-ansi-language: ES-MX;"><span style="mso-list: Ignore;">&middot;<span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><span lang="ES-MX" style="line-height: 115%; font-family: 'Verdana','sans-serif'; color: black; font-size: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-ansi-language: ES-MX;">BCS Metadata Model (BDC Service).<span style="mso-spacerun: yes;">&nbsp; </span><o:p></o:p></span></p>
<p class="MsoListParagraphCxSpLast"><span style="line-height: 115%; font-family: Symbol; color: black; font-size: 10pt; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol;"><span style="mso-list: Ignore;">&middot;<span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><span style="line-height: 115%; font-family: 'Verdana','sans-serif'; color: black; font-size: 10pt; mso-fareast-font-family: 'Times New Roman';">BCS Client Runtime.<o:p></o:p></span></p>
<p class="MsoNormal">In simple terms External content type enables us to define re-usable business entities. For more information about the External Content Types, see &ldquo;<a href="https://msdn.microsoft.com/en-us/library/ee556391(v=office.14).aspx"><span style="color: #0000ff;">External Content Types</span></a>&rdquo;. The BDC service models the metadata objects like the external content type and stores it in the metadata store. This essentially contains the metadata about the programmatic interfaces of the external systems. For more information about the BDC Service, see &ldquo;<a href="https://msdn.microsoft.com/en-us/library/ee559650(v=office.14).aspx"><span style="color: #0000ff;">Mechanics of Using Business Connectivity Services</span></a>&rdquo;.<o:p></o:p></p>
<p class="MsoNormal">The sample metadata model in xml format is presented in the appendix.<o:p></o:p></p>
<p class="MsoNormal">The BCS client runtime which is part of the Microsoft Office 2010 professional plus edition will use the metadata model to connect to the external data. This metadata will contain enough information on how to access the external system.<span style="mso-spacerun: yes;">&nbsp; </span><o:p></o:p></p>
<p class="Text">We can use the SharePoint Designer 2010 to create an External Content type. Following sections describe how to create this.</p>
<p><span style="mso-bookmark: _Toc244344298;"></span><span style="mso-bookmark: _Toc244344252;"></span><span style="mso-bookmark: _Toc244343837;"></span><span style="mso-bookmark: _Toc244342965;"></span><span style="mso-bookmark: _Toc244342784;"></span></p>
<h3>Creating "SalesBCS" External Content Type for the sample</h3>
<p class="Text"><o:p>&nbsp;</o:p>In order to provide the required external data to our chart in the PowerPoint presentation, you need to create at least one external content type. <o:p></o:p></p>
<p class="MsoNormal">The name and the name space will be used to identify an external content type at runtime. In <span style="font-family: Consolas; color: #a31515; font-size: 9.5pt;"><o:p></o:p></span></p>
<p class="MsoNormal">Once an external content type it is created you can configure the type of &ldquo;External Data Source&rdquo;.<span style="mso-spacerun: yes;">&nbsp; </span>It can be one of the following.<o:p></o:p></p>
<p class="MsoListParagraphCxSpFirst"><span style="line-height: 115%; font-family: 'Verdana','sans-serif'; color: black; font-size: 10pt; mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana;"><span style="mso-list: Ignore;">1.<span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp; </span></span></span><span style="line-height: 115%; font-family: 'Verdana','sans-serif'; color: black; font-size: 10pt; mso-fareast-font-family: 'Times New Roman';">.NET Type.<o:p></o:p></span></p>
<p class="MsoListParagraphCxSpMiddle"><span style="line-height: 115%; font-family: 'Verdana','sans-serif'; color: black; font-size: 10pt; mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana;"><span style="mso-list: Ignore;">2.<span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp; </span></span></span><span style="line-height: 115%; font-family: 'Verdana','sans-serif'; color: black; font-size: 10pt; mso-fareast-font-family: 'Times New Roman';">SQL Server.<o:p></o:p></span></p>
<p class="MsoListParagraphCxSpLast"><span style="line-height: 115%; font-family: 'Verdana','sans-serif'; color: black; font-size: 10pt; mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana;"><span style="mso-list: Ignore;">3.<span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp; </span></span></span><span style="line-height: 115%; font-family: 'Verdana','sans-serif'; color: black; font-size: 10pt; mso-fareast-font-family: 'Times New Roman';">WCF Service.<o:p></o:p></span></p>
<p class="Figure">In this example, you will use the &ldquo;SQL Server&rdquo; and the &ldquo;SalesTerritory&rdquo; table. This table contains sales details across various territories in the United States. This is the data that you will display in your PowerPoint presentation.<o:p></o:p></p>
<p class="Figure">You can set the various operations on this table like Create, Read, Update and Delete and specify filters, if any and these will be used while accessing the data. <o:p></o:p></p>
<p class="Figure">Save this information in SharePoint Designer 2010 for further processing.<o:p></o:p></p>
<p class="Text">Once the &ldquo;External Content Type is created you can use SharePoint Designer 2010 to create a list and view in the browser.<o:p></o:p></p>
<p class="Text"><o:p>&nbsp;</o:p></p>
<p class="Text">You will use the SharePoint designer 2010 to create the external content type &ldquo;SalesBCS&rdquo;. The example presented in this article connects to the Adventure Works database. Download the <a href="https://msftdbprodsamples.codeplex.com/releases/view/24854"><span style="color: #0000ff;">AdventureWorks 2008R2 November CTP</span></a> and install it. In&nbsp;reality this can be any database.<span style="mso-spacerun: yes;">&nbsp; </span>Once the database is installed, we can use SharePoint Designer 2010 to create an &ldquo;External Content Type&rdquo;.<span style="mso-spacerun: yes;">&nbsp; </span>This contains metadata about the data access capabilities of the external system. <o:p></o:p></p>
<p class="Text"><o:p>&nbsp;</o:p></p>
<p class="Text">Before creating the external content type you will need to set the permissions at the metadata store level. This will ensure that users will have appropriate permissions to get the external data.<o:p></o:p></p>
<p class="Text">To set the permissions <o:p></o:p></p>
<p class="Text"><span style="mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana;"><span style="mso-list: Ignore;">1.<span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp; </span></span></span>Start SharePoint 2010 <b style="mso-bidi-font-weight: normal;">Central Administration.</b><o:p></o:p></p>
<p class="Text"><span style="mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana;"><span style="mso-list: Ignore;">2.<span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp; </span></span></span>Click the <b style="mso-bidi-font-weight: normal;">Manage Service Applications</b> link on the home page of SharePoint 2010 Central Administration.<span style="mso-tab-count: 1;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><o:p></o:p></p>
<p class="Text"><span style="mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana;"><span style="mso-list: Ignore;">3.<span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp; </span></span></span>Click the <b style="mso-bidi-font-weight: normal;">Business Connectivity Service</b> link.<o:p></o:p></p>
<p class="Text"><span style="mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana;"><span style="mso-list: Ignore;">4.<span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp; </span></span></span>In the ribbon click on the <b style="mso-bidi-font-weight: normal;">Edit</b> tab and then click on the button <b style="mso-bidi-font-weight: normal;">Set Object Permissions</b>.<o:p></o:p></p>
<p class="Text"><span style="mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana;"><span style="mso-list: Ignore;">5.<span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp; </span></span></span>Add the account information and select all operations in the <b style="mso-bidi-font-weight: normal;">Permissions</b> list box.<o:p></o:p></p>
<p class="Text">This will set the appropriate permissions at the service level.<o:p></o:p></p>
<p class="Text"><span style="mso-spacerun: yes;">&nbsp; </span><o:p></o:p></p>
<p class="Text">To define a new External Content Type<o:p></o:p></p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="Text"><span style="mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana;"><span style="mso-list: Ignore;">1.<span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp; </span></span></span>Launch <b style="mso-bidi-font-weight: normal;">SharePoint Designer 2010</b>.<o:p></o:p></p>
<p class="Text"><span style="mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana;"><span style="mso-list: Ignore;">2.<span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp; </span></span></span>Click on the button <b style="mso-bidi-font-weight: normal;">Open Site</b> and specify the site address.<o:p></o:p></p>
<p class="Text"><span style="mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana;"><span style="mso-list: Ignore;">3.<span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp; </span></span></span>On the left Navigation pane, point to <b style="mso-bidi-font-weight: normal;">Site Objects</b>, and then click on the button <b style="mso-bidi-font-weight: normal;">External Content Types</b>.<o:p></o:p></p>
<p class="Text"><span style="mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana;"><span style="mso-list: Ignore;">4.<span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp; </span></span></span>Click on the ribbon button <b style="mso-bidi-font-weight: normal;">External Content Type</b>.<o:p></o:p></p>
<p class="Text"><span style="mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana;"><span style="mso-list: Ignore;">5.<span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp; </span></span></span>In the External Content Type information, specify the <b style="mso-bidi-font-weight: normal;">Name</b> as &ldquo;SalesBCS&rdquo;.<o:p></o:p></p>
<p class="Text"><span style="mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana;"><span style="mso-list: Ignore;">6.<span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp; </span></span></span>Specify the Namespace.<o:p></o:p></p>
<p class="Text"><b style="mso-bidi-font-weight: normal;"><span style="mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana;"><span style="mso-list: Ignore;">7.<span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp; </span></span></span></b>Select the <b style="mso-bidi-font-weight: normal;">Office Item Type </b>as<b style="mso-bidi-font-weight: normal;"> </b>Generic List<b style="mso-bidi-font-weight: normal;"> </b>-this is the default option.<b style="mso-bidi-font-weight: normal;"><o:p></o:p></b></p>
<p class="Text"><span style="mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana;"><span style="mso-list: Ignore;">8.<span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp; </span></span></span>Click on the link <b style="mso-bidi-font-weight: normal;">Click here to discover external data sources and define operations</b>.<o:p></o:p></p>
<p class="Text"><span style="mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana;"><span style="mso-list: Ignore;">9.<span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp; </span></span></span>Click on the button <b style="mso-bidi-font-weight: normal;">Add Connection</b>. <o:p></o:p></p>
<p class="Text"><span style="mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana;"><span style="mso-list: Ignore;">10.<span style="font: 7pt 'Times New Roman';"> </span></span></span>Select the <b style="mso-bidi-font-weight: normal;">Data Source Type</b> as SQL Server.<o:p></o:p></p>
<p class="Text"><span style="mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana;"><span style="mso-list: Ignore;">11.<span style="font: 7pt 'Times New Roman';"> </span></span></span>Specify the <b style="mso-bidi-font-weight: normal;">Database Server</b> and the <b style="mso-bidi-font-weight: normal;">Database name</b> as Adventure Works.<o:p></o:p></p>
<p class="Text"><span style="mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana;"><span style="mso-list: Ignore;">12.<span style="font: 7pt 'Times New Roman';"> </span></span></span>Expand the <b style="mso-bidi-font-weight: normal;">Adventure Works</b> database and select the <b style="mso-bidi-font-weight: normal;">Sales Territory</b> table.<o:p></o:p></p>
<p class="Text"><span style="mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana;"><span style="mso-list: Ignore;">13.<span style="font: 7pt 'Times New Roman';"> </span></span></span>Right-click on the <b style="mso-bidi-font-weight: normal;">Sales Territory table</b> and choose <b style="mso-bidi-font-weight: normal;">Create All Operations</b>.<o:p></o:p></p>
<p class="Text"><span style="mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana;"><span style="mso-list: Ignore;">14.<span style="font: 7pt 'Times New Roman';"> </span></span></span>In the <b style="mso-bidi-font-weight: normal;">All Operations</b> user interface click <b style="mso-bidi-font-weight: normal;">Finish</b>.<o:p></o:p></p>
<p class="Text"><span style="mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana;"><span style="mso-list: Ignore;">15.<span style="font: 7pt 'Times New Roman';"> </span></span></span>Click on the <b style="mso-bidi-font-weight: normal;">Save</b> button in the SharePoint designer. <o:p></o:p></p>
<p class="Text">This will save the External Content Type information in the BDC Metadata store.<o:p></o:p></p>
<p class="Text"><o:p>&nbsp;</o:p></p>
<p class="Text"><o:p>&nbsp;</o:p></p>
<p class="Figure">Following figure shows the External Content Type that is created using SharePoint designer 2010.<o:p></o:p></p>
<p>&nbsp;</p>
<p class="Figure"><span style="font-size: x-small;"><span style="font-family: Verdana;"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/33/30/7230.ExternalList.jpg.png" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-30/7230.ExternalList.jpg.png" border="0" />To create the External List <o:p></o:p></span></span></p>
<p class="Text"><span style="mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana;"><span style="mso-list: Ignore;"><span style="font-family: Verdana; font-size: x-small;">1.</span><span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: x-small;"><span style="font-family: Verdana;">Launch <b style="mso-bidi-font-weight: normal;">SharePoint Designer 2010</b>.<o:p></o:p></span></span></p>
<p class="Text"><span style="mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana;"><span style="mso-list: Ignore;"><span style="font-family: Verdana; font-size: x-small;">2.</span><span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: x-small;"><span style="font-family: Verdana;">Click on the button <b style="mso-bidi-font-weight: normal;">Open Site</b> to connect to the site<o:p></o:p></span></span></p>
<p class="Text"><span style="mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana;"><span style="mso-list: Ignore;"><span style="font-family: Verdana; font-size: x-small;">3.</span><span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: x-small;"><span style="font-family: Verdana;">On the left pane navigate to the SalesBCS external content type.<o:p></o:p></span></span></p>
<p class="Text"><span style="mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana;"><span style="mso-list: Ignore;"><span style="font-family: Verdana; font-size: x-small;">4.</span><span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: x-small;"><span style="font-family: Verdana;">Click on ribbon button <b style="mso-bidi-font-weight: normal;">Create Lists &amp; Forms</b>.<o:p></o:p></span></span></p>
<p class="Text"><span style="mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana;"><span style="mso-list: Ignore;"><span style="font-family: Verdana; font-size: x-small;">5.</span><span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: x-small;"><span style="font-family: Verdana;">Choose <b style="mso-bidi-font-weight: normal;">Create New List</b> and specify the List Name.<o:p></o:p></span></span></p>
<p class="Text"><span style="mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana;"><span style="mso-list: Ignore;"><span style="font-family: Verdana; font-size: x-small;">6.</span><span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: x-small;"><span style="font-family: Verdana;">Click <b style="mso-bidi-font-weight: normal;">Ok</b> to create the list. - This will create the external list.<o:p></o:p></span></span></p>
<p class="Text"><span style="mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana;"><span style="mso-list: Ignore;"><span style="font-family: Verdana; font-size: x-small;">7.</span><span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: x-small;"><span style="font-family: Verdana;">Click on the ribbon button <b style="mso-bidi-font-weight: normal;">Preview in Browser</b> to view the list in the browser.<o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="font-size: x-small;"><span style="font-family: Verdana;">Following section describes how to connect to the back-end using the BCS client runtime.<o:p></o:p></span></span></p>
<p><o:p><span style="font-family: Verdana; font-size: x-small;"></span></o:p><span style="font-family: Verdana;"><span style="font-size: x-small;">PowerPoint add-in will use BCS client runtime object model, which internally uses the Metadata model to connect to the back-end data. The custom task pane in our sample will use the following lines of code to populate the user control using the external data. <o:p></o:p></span></span></p>
<h3 style="MARGIN: 9pt 0in 3pt"><o:p>Connecting to back-end data using BCS client runtime:</o:p></h3>
<p class="MsoNormal">&nbsp;</p>
<p>&nbsp;</p>
<p class="Code"><span style="font-family: Courier New;"><span style="font-size: x-small;">public void PopulateControls()<o:p></o:p></span></span></p>
<p class="Code"><span style="font-family: Courier New;"><span style="font-size: x-small;">{<o:p></o:p></span></span></p>
<p class="Code"><span style="font-family: Courier New;"><span style="font-size: x-small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp; </span>if (!CheckDependentDataSolution())<o:p></o:p></span></span></p>
<p class="Code"><span style="font-family: Courier New;"><span style="font-size: x-small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>return;<o:p></o:p></span></span></p>
<p class="Code"><span style="font-family: Courier New;"><span style="font-size: x-small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp; </span>RemoteSharedFileBackedMetadataCatalog Catalog = new RemoteSharedFileBackedMetadataCatalog();<o:p></o:p></span></span></p>
<p class="Code"><span style="font-family: Courier New;"><span style="font-size: x-small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp; </span>IEntityInstanceEnumerator InstanceEnumerator = null;<o:p></o:p></span></span></p>
<p class="Code"><span style="font-family: Courier New;"><span style="font-size: x-small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp; </span>INamespacedEntityDictionaryDictionary entDictDict = Catalog.GetEntities("*");<o:p></o:p></span></span></p>
<p class="Code"><span style="font-family: Courier New;"><span style="font-size: x-small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp; </span>foreach (INamedEntityDictionary entDict in entDictDict.Values)<o:p></o:p></span></span></p>
<p class="Code"><span style="font-family: Courier New;"><span style="font-size: x-small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp; </span>{<o:p></o:p></span></span></p>
<p class="Code"><span style="font-family: Courier New;"><span style="font-size: x-small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>foreach (IEntity entity in entDict.Values)<o:p></o:p></span></span></p>
<p class="Code"><span style="font-family: Courier New;"><span style="font-size: x-small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>{<o:p></o:p></span></span></p>
<p class="Code"><span style="font-family: Courier New;"><span style="font-size: x-small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>EntityLookup[entity.Name] = entity;<o:p></o:p></span></span></p>
<p class="Code"><span style="font-family: Courier New;"><span style="font-size: x-small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>ectList.Items.Add(entity.Name);<o:p></o:p></span></span></p>
<p class="Code"><span style="font-family: Courier New;"><span style="font-size: x-small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><o:p></o:p></span></span></p>
<p class="Code"><span style="font-family: Courier New;"><span style="font-size: x-small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>}<o:p></o:p></span></span></p>
<p class="Code"><span style="font-family: Courier New;"><span style="font-size: x-small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp; </span>}<o:p></o:p></span></span></p>
<p class="Code"><span style="font-family: Courier New;"><span style="font-size: x-small;">//<span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp; </span>Populate the controls<o:p></o:p></span></span></p>
<p class="Code"><span style="font-family: Courier New;"><span style="font-size: x-small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp; </span><o:p></o:p></span></span></p>
<p class="Code"><span style="font-family: Courier New;"><span style="font-size: x-small;">}<o:p></o:p></span></span></p>
<p class="Text"><span style="font-size: x-small;"><span style="font-family: Verdana;">It first begins by creating an instance of RemoteSharedFileBackedMetadataCatalog. This is the base object that uses metadata model to connect to the back-end database. The GetEntities method will return an INamespacedEntityDictionaryDictionary interface which represents the external content type&rsquo;s collection from the back-end. The GetEntity method will return an IEntityInstanceEnumerator interface which represents collection or stream as &ldquo;entity&rdquo; instances from the back-end. The term &ldquo;entity&rdquo; here is the external content type. The term &ldquo;entity&rdquo; is used in the programmatic interfaces. The documentation and the SharePoint Designer 2010 will call this as the &ldquo;External Content Type&rdquo;. We obtain an instance of InstanceEnumerator based on set of filters against the LobSystemInstance, which in this case is the Adventure Works database instance. The GetMethodInstances method returns the instances of the entity. Then you can get a DataTable that contains the external data using the IRuntimeHelper interface. <o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="font-size: x-small;"><span style="font-family: Verdana;">The following section describe how to create the data solution to get the metadata model. <o:p></o:p></span></span></p>
<p>&nbsp;</p>
<p><o:p></o:p></p>
<p>&nbsp;</p>
<p class="Text"><span style="font-family: Verdana; font-size: x-small;">In order to get the external data using the BCS client object model in the PowerPoint add-in you need to get the metadata model to the client computer. The </span><a href="https://code.msdn.microsoft.com/odcsps14bcspkgtool"><span style="mso-bidi-font-size: 12.0pt;"><span style="font-family: Verdana; color: #0000ff; font-size: x-small;">BCS Solution Packaging Tool</span></span></a><span style="font-size: x-small;"><span style="font-family: Verdana;"> helps in getting the external data to the add-in. <o:p></o:p></span></span></p>
<p class="Text"><span style="font-family: Verdana; font-size: x-small;">For more information on how to create the data solution for office add-in, download the &ldquo;</span><a href="https://code.msdn.microsoft.com/odcsps14bcspkgtool"><span style="mso-bidi-font-size: 12.0pt;"><span style="font-family: Verdana; color: #0000ff; font-size: x-small;">BCS Solution Packaging Tool</span></span></a><span style="font-size: x-small;"><span style="font-family: Verdana;">&rdquo;. You need to ensure that the Data Solution is functioning before invoking the BCS runtime APIs. To do this<o:p></o:p></span></span></p>
<p class="MsoListParagraph"><span style="mso-bidi-font-size: 12.0pt;"><o:p><span style="font-family: Calibri; font-size: small;">&nbsp;</span></o:p></span></p>
<p class="Text"><span style="mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana;"><span style="mso-list: Ignore;"><span style="font-family: Verdana; font-size: x-small;">1.</span><span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: x-small;"><span style="font-family: Verdana;">Launch the BCS Solution Packaging Tool.<o:p></o:p></span></span></p>
<p class="Text"><span style="mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana;"><span style="mso-list: Ignore;"><span style="font-family: Verdana; font-size: x-small;">2.</span><span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: x-small;"><span style="font-family: Verdana;">Navigate to the section &ldquo;Package BCS Data Only Solution for Office Add-in&rdquo;.<o:p></o:p></span></span></p>
<p class="Text"><span style="mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana;"><span style="mso-list: Ignore;"><span style="font-family: Verdana; font-size: x-small;">3.</span><span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: x-small;"><span style="font-family: Verdana;">Copy the &ldquo;Code Example&rdquo;.<o:p></o:p></span></span></p>
<p class="MsoListParagraph"><span style="mso-bidi-font-size: 12.0pt;"><o:p><span style="font-family: Calibri; font-size: small;">&nbsp;</span></o:p></span></p>
<p class="Text"><span style="font-family: Verdana;"><span style="font-size: x-small;">You can now use it in the add-in. The &ldquo;CheckDependentDataSolution&rdquo; from the BCS Solution Packaging Tool will ensure that the metadata model is available before invoking the BCS runtime APIs. <o:p></o:p></span></span></p>
<p class="Text"><span style="font-family: Verdana;"><span style="font-size: x-small;">In the PowerPoint add-in before invoking the external data you need to execute the following code.<o:p></o:p></span></span></p>
<p class="Code"><span style="font-size: x-small;"><span style="font-family: Courier New;"><span style="mso-spacerun: yes;">&nbsp;</span>public void PopulateControls()<o:p></o:p></span></span></p>
<p class="Code"><span style="font-size: x-small;"><span style="font-family: Courier New;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>{<o:p></o:p></span></span></p>
<p class="Code"><span style="font-size: x-small;"><span style="font-family: Courier New;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>if (!CheckDependentDataSolution())<o:p></o:p></span></span></p>
<p class="Code"><span style="font-size: x-small;"><span style="font-family: Courier New;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>return;<o:p></o:p></span></span></p>
<p class="Code"><span style="font-size: x-small;"><span style="font-family: Courier New;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>//Get the external data<o:p></o:p></span></span></p>
<p class="Code"><span style="font-size: x-small;"><span style="font-family: Courier New;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>//Populate the controls<o:p></o:p></span></span></p>
<p class="Code"><span style="font-size: x-small;"><span style="font-family: Courier New;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>}<o:p></o:p></span></span></p>
<h3 style="margin: 9pt 0in 3pt;">
<h1 style="MARGIN: 9pt 0in 3pt"><span style="font-size: x-small;"><span style="font-family: Verdana;"><span style="font-size: medium;">Packaging and Deploying the Solution</span></span></span></h1>
<p><span style="font-size: x-small;"><span style="font-family: Verdana;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp; </span><o:p></o:p></span></span></p>
</h3>
<p class="Text"><span style="mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana;"><span style="mso-list: Ignore;"><span style="font-family: Verdana; font-size: x-small;">Before installing the PowerPoint add-in you need to package and deploy the solution. To do this</span></span></span></p>
<p class="Text"><span style="mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana;"><span style="mso-list: Ignore;"><span style="font-family: Verdana; font-size: x-small;">1.</span><span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: x-small;"><span style="font-family: Verdana;"><span style="mso-bidi-font-size: 12.0pt;">Launch the </span>BCS Solution Packaging Tool<o:p></o:p></span></span></p>
<p class="Text"><span style="mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana;"><span style="mso-list: Ignore;"><span style="font-family: Verdana; font-size: x-small;">2.</span><span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: x-small;"><span style="font-family: Verdana;"><span style="mso-bidi-font-size: 12.0pt;">Specify the <b style="mso-bidi-font-weight: normal;">Solution Name.</b></span><o:p></o:p></span></span></p>
<p class="Text"><span style="mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana;"><span style="mso-list: Ignore;"><span style="font-family: Verdana; font-size: x-small;">3.</span><span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: x-small;"><span style="font-family: Verdana;"><span style="mso-bidi-font-size: 12.0pt;">Specify the <b style="mso-bidi-font-weight: normal;">Solution Version.</b></span><o:p></o:p></span></span></p>
<p class="Text"><span style="mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana;"><span style="mso-list: Ignore;"><span style="font-family: Verdana; font-size: x-small;">4.</span><span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: x-small;"><span style="font-family: Verdana;"><span style="mso-bidi-font-size: 12.0pt;">Select the solution type to &ldquo;<b style="mso-bidi-font-weight: normal;">Data Solution for Office Add-in</b>&rdquo; from the combo box.</span><o:p></o:p></span></span></p>
<p class="Text"><span style="mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana;"><span style="mso-list: Ignore;"><span style="font-family: Verdana; font-size: x-small;">5.</span><span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: x-small;"><span style="font-family: Verdana;"><span style="mso-bidi-font-size: 12.0pt;">Browse and select the<span style="mso-spacerun: yes;">&nbsp; </span><b style="mso-bidi-font-weight: normal;">Source Folder Path</b></span><o:p></o:p></span></span></p>
<p class="Text"><span style="font-size: x-small;"><span style="font-family: Verdana;"><span style="mso-bidi-font-size: 12.0pt;">This folder will contain the PowerPoint add-in solution. Place the metadata model and the subscriptions xml file in this folder.</span><o:p></o:p></span></span></p>
<p class="Text"><span style="mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana;"><span style="mso-list: Ignore;"><span style="font-family: Verdana; font-size: x-small;">6.</span><span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: x-small;"><span style="font-family: Verdana;">Browse and select <b style="mso-bidi-font-weight: normal;">Output Folder Path</b><o:p></o:p></span></span></p>
<p class="Text"><span style="mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana;"><span style="mso-list: Ignore;"><span style="font-family: Verdana; font-size: x-small;">7.</span><span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: x-small;"><span style="font-family: Verdana;">Click on the button <b style="mso-bidi-font-weight: normal;">Package</b><o:p></o:p></span></span></p>
<p class="Text"><span style="font-size: x-small;"><span style="font-family: Verdana;">Click on the button<b style="mso-bidi-font-weight: normal;"> Deploy<o:p></o:p></b></span></span></p>
<p class="Text"><span style="font-size: x-small;"><span style="font-family: Verdana;">This will deploy the solution package to the BCS runtime. <o:p></o:p></span></span></p>
<p class="Text"><span style="font-family: Verdana; font-size: x-small;">The subscription file is an xml file that contains the information about what gets populated in the cache. For more information about the subscriptions, see &ldquo;</span><a href="https://msdn.microsoft.com/en-us/library/ee558389(office.14).aspx"><span style="font-family: Verdana; color: #0000ff; font-size: x-small;">Cache Subscriptions</span></a><span style="font-size: x-small;"><span style="font-family: Verdana;">&rdquo;. The appendix provides the information about how to export the metadata model.<o:p></o:p></span></span></p>
<p>&nbsp;</p>
<p><span style="mso-font-kerning: 0pt;"><o:p></o:p></span></p>
<p>&nbsp;</p>
<p class="MsoNormal"><span style="font-size: x-small;"><span style="font-family: Verdana;"><span style="mso-spacerun: yes;">&nbsp; </span>Following are the pre-requisites that are required to run the solution<o:p></o:p></span></span></p>
<p class="Text"><span style="mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana;"><span style="mso-list: Ignore;"><span style="font-family: Verdana; font-size: x-small;">1.</span><span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: x-small;"><span style="font-family: Verdana;">Install Visual Studio 2010 <o:p></o:p></span></span></p>
<p class="Text"><span style="mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana;"><span style="mso-list: Ignore;"><span style="font-family: Verdana; font-size: x-small;">2.</span><span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: x-small;"><span style="font-family: Verdana;">Install Office 2010 Professional Plus edition <o:p></o:p></span></span></p>
<p class="Text"><span style="mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana;"><span style="mso-list: Ignore;"><span style="font-family: Verdana; font-size: x-small;">3.</span><span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: x-small;"><span style="font-family: Verdana;">Install SharePoint 2010 <o:p></o:p></span></span></p>
<p class="Text"><span style="mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana;"><span style="mso-list: Ignore;"><span style="font-family: Verdana; font-size: x-small;">4.</span><span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-family: Verdana; font-size: x-small;">Download and Install the </span><a href="https://msftdbprodsamples.codeplex.com/releases/view/24854"><span style="font-family: Verdana; color: #0000ff; font-size: x-small;">AdventureWorks 2008R2 November CTP</span></a><o:p></o:p></p>
<p class="Text"><span style="font-size: x-small;"><span style="font-family: Verdana;">Download the code and build it using Visual Studio 2010. <o:p></o:p></span></span></p>
<p class="Text"><span style="mso-bidi-font-size: 12.0pt;"><span style="font-size: x-small;"><span style="font-family: Verdana;">The following procedure explains how to run the sample.<o:p></o:p></span></span></span></p>
<p class="Text"><span style="mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana;"><span style="mso-list: Ignore;"><span style="font-family: Verdana; font-size: x-small;">1.</span><span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: x-small;"><span style="font-family: Verdana;">Press-F5<o:p></o:p></span></span></p>
<p class="Text"><span style="mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana;"><span style="mso-list: Ignore;"><span style="font-family: Verdana; font-size: x-small;">2.</span><span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: x-small;"><span style="font-family: Verdana;">This will launch the PowerPoint presentation<o:p></o:p></span></span></p>
<p class="Text"><span style="mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana;"><span style="mso-list: Ignore;"><span style="font-family: Verdana; font-size: x-small;">3.</span><span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: x-small;"><span style="font-family: Verdana;">Click on the ribbon tab &ldquo;BCS&rdquo;<o:p></o:p></span></span></p>
<p class="Text"><span style="mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana;"><span style="mso-list: Ignore;"><span style="font-family: Verdana; font-size: x-small;">4.</span><span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: x-small;"><span style="font-family: Verdana;">Click on the ribbon button &ldquo;Add External Data to Chart&rdquo; <o:p></o:p></span></span></p>
<p class="Text"><span style="mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana;"><span style="mso-list: Ignore;"><span style="font-family: Verdana; font-size: x-small;">5.</span><span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: x-small;"><span style="font-family: Verdana;">This will open the custom task pane<o:p></o:p></span></span></p>
<p class="Text"><span style="mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana;"><span style="mso-list: Ignore;"><span style="font-family: Verdana; font-size: x-small;">6.</span><span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: x-small;"><span style="font-family: Verdana;">Select an item from the &ldquo;Select External Content Type&rdquo; combo box.<o:p></o:p></span></span></p>
<p class="Text"><span style="mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana;"><span style="mso-list: Ignore;"><span style="font-family: Verdana; font-size: x-small;">7.</span><span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: x-small;"><span style="font-family: Verdana;">Select an item from the &ldquo;Select Series Name&rdquo; combo box.<o:p></o:p></span></span></p>
<p class="Text"><span style="mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana;"><span style="mso-list: Ignore;"><span style="font-family: Verdana; font-size: x-small;">8.</span><span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: x-small;"><span style="font-family: Verdana;">Check an item from the &ldquo;Select Chart Categories&rdquo; check box list control.<o:p></o:p></span></span></p>
<p class="Text"><span style="mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana;"><span style="mso-list: Ignore;"><span style="font-family: Verdana; font-size: x-small;">9.</span><span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: x-small;"><span style="font-family: Verdana;">Click on the button &ldquo;Insert Chart&rdquo;<o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="font-size: x-small;"><span style="font-family: Verdana;">This will insert the chart on the active slide like this.<o:p></o:p></span></span></p>
<p>&nbsp;</p>
<p class="MsoNormal"><span style="font-size: x-small;"><span style="font-family: Verdana;"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/33/30/8203.Addin.jpg" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-30/8203.Addin.jpg" border="0" />To update an existing chart you need to select the existing chart. Then you need to click on the button &ldquo;Update Existing Chart&rdquo;. This will use the selected values in the custom task pane to update an existing chart.<o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="font-size: x-small;"><span style="font-family: Verdana;">When you insert a chart, it automatically adds an Excel sheet. This sheet will contain the data that chart will use to insert the chart. You need to force a Garbage Collection to ensure memory consumed by the excel application is reclaimed. The excel process will remain in memory for some indeterminate time after we quit the excel application. A repeated call to GC.Collect is necessary because the memory for the Excel reference might have survived the first pass, although it will then have been marked for collection on the next pass.<o:p></o:p></span></span></p>
<p>&nbsp;</p>
<p><span style="mso-font-kerning: 0pt;"><o:p></o:p></span></p>
<p>&nbsp;</p>
<p class="Text"><span style="font-size: x-small;"><span style="font-family: Verdana;">You have the following options to deploy the PowerPoint add-in.<o:p></o:p></span></span></p>
<p class="Text"><span style="mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana;"><span style="mso-list: Ignore;"><span style="font-family: Verdana; font-size: x-small;">1.</span><span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: x-small;"><span style="font-family: Verdana;">The Visual Studio publish wizard<o:p></o:p></span></span></p>
<p class="Text"><span style="mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana;"><span style="mso-list: Ignore;"><span style="font-family: Verdana; font-size: x-small;">2.</span><span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: x-small;"><span style="font-family: Verdana;">The Windows installer.<o:p></o:p></span></span></p>
<p class="Text"><span style="font-size: x-small;"><span style="font-family: Verdana;">Deploying the add-in using the publish wizard is simple. For advanced deployment features like installing the add-in for all users, executing some custom actions the windows installer will be the preferable option.<o:p></o:p></span></span></p>
<p class="Text"><span style="font-size: x-small;"><span style="font-family: Verdana;">To deploy the add-in using the publish wizard<o:p></o:p></span></span></p>
<p class="Text"><span style="mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana;"><span style="mso-list: Ignore;"><span style="font-family: Verdana; font-size: x-small;">1.</span><span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: x-small;"><span style="font-family: Verdana;">Launch the Visual studio 2010 <o:p></o:p></span></span></p>
<p class="Text"><span style="mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana;"><span style="mso-list: Ignore;"><span style="font-family: Verdana; font-size: x-small;">2.</span><span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: x-small;"><span style="font-family: Verdana;">Open the PowerPoint add-in project.<o:p></o:p></span></span></p>
<p class="Text"><span style="mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana;"><span style="mso-list: Ignore;"><span style="font-family: Verdana; font-size: x-small;">3.</span><span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: x-small;"><span style="font-family: Verdana;">Right click on the solution explorer to open the Publish property page<o:p></o:p></span></span></p>
<p class="Text"><span style="mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana;"><span style="mso-list: Ignore;"><span style="font-family: Verdana; font-size: x-small;">4.</span><span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: x-small;"><span style="font-family: Verdana;">Specify the Publish location<o:p></o:p></span></span></p>
<p class="Text"><span style="mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana;"><span style="mso-list: Ignore;"><span style="font-family: Verdana; font-size: x-small;">5.</span><span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: x-small;"><span style="font-family: Verdana;">Click finish<o:p></o:p></span></span></p>
<p class="Text"><span style="mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana;"><span style="mso-list: Ignore;"><span style="font-family: Verdana; font-size: x-small;">6.</span><span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: x-small;"><span style="font-family: Verdana;">Double click on the VSTO deployment file.<o:p></o:p></span></span></p>
<p class="Text"><span style="font-size: x-small;"><span style="font-family: Verdana;">This will install the PowerPoint add-in to the computer.<o:p></o:p></span></span></p>
<p class="Text"><span style="font-family: Verdana; font-size: x-small;">For more information on advanced deployment using the windows installer, see &ldquo;</span><a href="https://msdn.microsoft.com/en-us/library/bb386179(VS.100).aspx"><span style="font-family: Verdana; color: #0000ff; font-size: x-small;">Deploying Office Solutions by Using Windows Installer</span></a><span style="font-size: x-small;"><span style="font-family: Verdana;">&rdquo;. <o:p></o:p></span></span></p>
<h1 class="Text"><span style="font-size: x-small;"><span style="font-family: Verdana;"><span style="mso-spacerun: yes;">Appendix A: SalesBCS Metadata Model&nbsp;</span></span></span></h1>
<p class="Text"><span style="font-size: x-small;"><span style="font-family: Verdana;"><span style="mso-spacerun: yes;"></span></span></span><span style="font-size: x-small;"><span style="font-family: Verdana;">This section provides the Metadata model for our SalesBCS external content type.<o:p></o:p></span></span></p>
<p>&nbsp;</p>
<p class="Text"><span style="font-size: x-small;"><span style="font-family: Verdana;">To view and export the Metadata model<o:p></o:p></span></span></p>
<p class="Text"><span style="mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana;"><span style="mso-list: Ignore;"><span style="font-family: Verdana; font-size: x-small;">1.</span><span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: x-small;"><span style="font-family: Verdana;">Launch <b style="mso-bidi-font-weight: normal;">SharePoint Designer 2010</b>.<o:p></o:p></span></span></p>
<p class="Text"><span style="mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana;"><span style="mso-list: Ignore;"><span style="font-family: Verdana; font-size: x-small;">2.</span><span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: x-small;"><span style="font-family: Verdana;">Click on the button <b style="mso-bidi-font-weight: normal;">Open Site</b> to connect to the site<o:p></o:p></span></span></p>
<p class="Text"><span style="mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana;"><span style="mso-list: Ignore;"><span style="font-family: Verdana; font-size: x-small;">3.</span><span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: x-small;"><span style="font-family: Verdana;">On the left Navigation pane, point to Site Objects, and then on the button <b style="mso-bidi-font-weight: normal;">External Content Types</b>.<o:p></o:p></span></span></p>
<p class="Text"><span style="mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana;"><span style="mso-list: Ignore;"><span style="font-family: Verdana; font-size: x-small;">4.</span><span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: x-small;"><span style="font-family: Verdana;">Right-click on the <b style="mso-bidi-font-weight: normal;">SalesBCS</b> External Content Type and select <b style="mso-bidi-font-weight: normal;">Export Application Data Model</b>.<o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="font-size: x-small;"><span style="font-family: Verdana;">BCS client runtime will use this to connect to back-end. Metadata model for our SalesBCS in Xml format looks like this.<o:p></o:p></span></span></p>
<p>&nbsp;<span style="font-size: x-small;"><span style="font-family: Verdana;"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/33/30/5415.MetadataModel.jpg" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-30/5415.MetadataModel.jpg" border="0" /></span></span></p>
<h1 class="MsoNormal">Conclusion</h1>
<p class="MsoNormal"><span style="font-size: x-small;"><span style="font-family: Verdana;">BCS 2010 offers a new way of integrating external data to Office applications. It handles the complicated problem of fetching and synchronizing the data between Office and one or more external systems. Without out BCS it would be very difficult to implement. This sort of rich integration to Office applications with BCS enables us to build classic Office Business Applications.<o:p></o:p></span></span></p>
<p><span style="mso-font-kerning: 0pt"><o:p></o:p></span></p>
<h1>Additional Resources&nbsp;</h1>
<p><a href="https://msdn.microsoft.com/en-us/library/ee556826(office.14).aspx"><span style="color: #0000ff;"><span style="font-size: x-small;"><span style="font-family: Verdana;"><span style="mso-bookmark: _Toc244342807;"><span style="mso-bookmark: _Toc244342988;"><span style="mso-bookmark: _Toc244343865;"><span style="mso-bookmark: _Toc244344280;"><span style="mso-bookmark: _Toc244344326;"><span style="mso-bookmark: _Toc248086372;">What is Microsoft Business Connectivity Services?</span></span></span></span></span></span><span style="mso-bookmark: _Toc244342807;"><span style="mso-bookmark: _Toc244342988;"><span style="mso-bookmark: _Toc244343865;"><span style="mso-bookmark: _Toc244344280;"><span style="mso-bookmark: _Toc244344326;"><span style="mso-bookmark: _Toc248086372;"></span></span></span></span></span></span></span></span></span></a><span style="mso-bookmark: _Toc244342807;"><span style="mso-bookmark: _Toc244342988;"><span style="mso-bookmark: _Toc244343865;"><span style="mso-bookmark: _Toc244344280;"><span style="mso-bookmark: _Toc244344326;"><span style="mso-bookmark: _Toc248086372;"><o:p></o:p></span></span></span></span></span></span></p>
<p class="Text"><span style="mso-bookmark: _Toc244342807;"><span style="mso-bookmark: _Toc244342988;"><span style="mso-bookmark: _Toc244343865;"><span style="mso-bookmark: _Toc244344280;"><span style="mso-bookmark: _Toc244344326;"><span style="mso-bookmark: _Toc248086372;"></span></span></span></span></span></span><a href="https://msdn.microsoft.com/en-us/library/ee557359(office.14).aspx"><span style="mso-bookmark: _Toc244342807;"><span style="mso-bookmark: _Toc244342988;"><span style="mso-bookmark: _Toc244343865;"><span style="mso-bookmark: _Toc244344280;"><span style="mso-bookmark: _Toc244344326;"><span style="mso-bookmark: _Toc248086372;"><span style="font-family: Verdana; color: #0000ff; font-size: x-small;">BCS Object Model Samples</span></span></span></span></span></span></span></a><span style="mso-bookmark: _Toc244342807;"><span style="mso-bookmark: _Toc244342988;"><span style="mso-bookmark: _Toc244343865;"><span style="mso-bookmark: _Toc244344280;"><span style="mso-bookmark: _Toc244344326;"><span style="mso-bookmark: _Toc248086372;"><o:p></o:p></span></span></span></span></span></span></p>
<p class="Text"><span style="font-size: x-small;"><span style="font-family: Verdana;"><span style="mso-bookmark: _Toc244342807;"><span style="mso-bookmark: _Toc244342988;"><span style="mso-bookmark: _Toc244343865;"><span style="mso-bookmark: _Toc244344280;"><span style="mso-bookmark: _Toc244344326;"><span style="mso-bookmark: _Toc248086372;">BCS Blogs:</span></span></span></span></span></span><o:p></o:p></span></span></p>
<p class="Text"><span class="MsoHyperlink"><span style="text-decoration: underline;"><span style="font-family: Verdana; color: #0000ff; font-size: x-small;">https://blogs.msdn.com/bcs/</span></span></span><b style="mso-bidi-font-weight: normal;"><o:p></o:p></b></p>
<p>&nbsp;</p>
<p>&nbsp;<span class="Bold"></span></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<h1 style="MARGIN: 9pt 0in 3pt"></h1>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><span style="font-family: Verdana;"></span></p>
</p>
<p class="Text"><a href="https://cid-69d9fec9f0fc367a.office.live.com/browse.aspx/BCS?uc=1">Download the code</a><o:p></o:p></p>]]></content:encoded>
    </item>
    <item>
      <title>How to effectively maintain the state of the ribbon in outlook 2010</title>
      <link>https://docs.microsoft.com/archive/blogs/anilkumar/how-to-effectively-maintain-the-state-of-the-ribbon-in-outlook-2010</link>
      <pubDate>Mon, 19 Jul 2010 13:56:00 GMT</pubDate>
      <dc:creator><![CDATA[AnilKumar_bhaskara]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/anilkumar/2010/07/19/how-to-effectively-maintain-the-state-of-the-ribbon-in-outlook-2010/</guid>
      <description><![CDATA[Summary 
The Outlook 2010 programmability interface allows us to customize the ribbon. You can...]]></description>
      <content:encoded><![CDATA[<p class="Text"><a name="_Toc244341087"></a><a name="_Toc267325789"><span style="mso-bookmark: _Toc244341087;"><span style="font-size: x-small;"><span style="font-family: Verdana;"><span class="Bold"><strong>Summary</strong></span> <o:p></o:p></span></span></span></a></p>
<p class="Text"><span style="mso-bookmark: _Toc267325789;"><span style="mso-bookmark: _Toc244341087;"><span style="font-size: x-small;"><span style="font-family: Verdana;">The Outlook 2010 programmability interface allows us to customize the ribbon. You can create an add-in for outlook using the Visual Studio 2010 and this will contain the ribbon. You need to supply the xml markup for the ribbon. Since ribbon is part of the add-in every outlook window will share the ribbon. Sometimes it is essential to manage the state of the ribbon to render the ribbon controls properly. This article will explain how to properly manage the state of the ribbon in outlook 2010 in order to render it properly.<o:p></o:p></span></span></span></span></p>
<h1 style="margin: 9pt 0in 3pt;"><span style="mso-bookmark: _Toc267325789;"><span style="mso-bookmark: _Toc244341087;"><o:p><span style="font-family: Verdana;">&nbsp;</span></o:p></span></span></h1>
<h1 style="margin: 9pt 0in 3pt;"><span style="font-family: Verdana;"><span style="mso-bookmark: _Toc267325789;"><span style="mso-bookmark: _Toc244341087;">About the sample</span></span><span style="mso-bookmark: _Toc244341087;"><o:p></o:p></span></span></h1>
<p><span style="mso-bookmark: _Toc244341087;"></span></p>
<p class="MsoNormal"><span style="font-size: x-small;"><span style="font-family: Verdana;">To begin with let us take a simple example of displaying the ribbon in Outlook 2010 with some toggle buttons. There is one more toggle button, when pressed, will disable all buttons. When you un-toggle it will enable all buttons. Here we are programmatically enabling/disabling these buttons like this. <o:p></o:p></span></span></p>
<p class="MsoNormal"><o:p><span style="font-family: Verdana; font-size: x-small;">&nbsp;</span></o:p></p>
<p class="Text"><span style="font-size: x-small;"><span style="font-family: Verdana;">State management of ribbon is useful in these scenarios .One of the common practices to address this problem is to have a Boolean variable in the ribbon class, set its value either true or false depending upon the action , call the invalidate method in the ribbon. You need to return the Boolean value appropriately in the callback function. <o:p></o:p></span></span></p>
<p class="Text"><span style="font-size: x-small;"><span style="font-family: Verdana;">This at first look like it&rsquo;s working. However if you open a new email again and click on the ribbon tab, you will see that the new email will also have these buttons disabled.<o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="font-size: x-small;"><span style="font-family: Verdana;">This is because of the fact that, when we call the invalidate method to disable the buttons, outlook will evaluate the call backs for the ribbon for all new windows.<o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="font-size: x-small;"><span style="font-family: Verdana;">The following section will explain how to solve this by use of the wrapper objects.<o:p></o:p></span></span></p>
<h1 style="margin: 9pt 0in 3pt;"><a name="_Toc267325790"><span style="mso-font-kerning: 0pt;"><span style="font-family: Verdana;">The Wrapper Objects for Inspector and Explorer windows.</span></span></a><span style="mso-font-kerning: 0pt;"><o:p></o:p></span></h1>
<p class="MsoNormal"><span style="font-family: Verdana;"><span style="font-size: x-small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp; </span><o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="font-family: Verdana;"><span style="font-size: x-small;">The best way to maintain the state of the ribbon is to create the wrapper classes for the Inspector and Explorer windows. <b style="mso-bidi-font-weight: normal;">Eric Carter and Eric Lippert</b>&nbsp;has written an excellent book on VSTO programming(Visual Studio Tools for Office 2007: VSTO for Excel, Word and Outlook)&nbsp; and he has explained how to create the wrapper objects for Inspector and Explorer windows. We will extend them to use it in the context of ribbon effectively. Basically these wrapper objects help us manage the Inspector and Explorer windows. We will store any window specific information in these classes. Since these objects are specific to each window, when we call the invalidate method of the ribbon, we can use the associated wrapper object to render the ribbon properly.<o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="font-family: Verdana;"><span style="font-size: x-small;">We can maintain a collection of these wrapper objects and fetch the right one based on the active window.<o:p></o:p></span></span></p>
<p class="MsoNormal"><o:p><span style="font-family: Verdana; font-size: x-small;">&nbsp;</span></o:p></p>
<p class="MsoNormal"><span style="font-family: Verdana;"><span style="font-size: x-small;">You attach an event handler to the &ldquo;NewExplorer&rdquo; and in the event handler you can create the instance of the explorer wrapper and add it to the wrappers collection. Given below is the code that creates the wrapper object for the Explorer window. You will also need to add the active explorer to the wrappers collection.<o:p></o:p></span></span></p>
<p class="Code"><span style="font-family: Courier New;"><span style="font-size: x-small;">private void ThisAddIn_Startup(object sender, System.EventArgs e)<o:p></o:p></span></span></p>
<p class="Code"><span style="font-family: Courier New;"><span style="font-size: x-small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>{<o:p></o:p></span></span></p>
<p class="Code"><span style="font-family: Courier New;"><span style="font-size: x-small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><o:p></o:p></span></span></p>
<p class="Code"><span style="font-family: Courier New;"><span style="font-size: x-small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>explorerWrappers = new Collection&lt;ExplorerWrapper&gt;();<o:p></o:p></span></span></p>
<p class="Code"><span style="font-family: Courier New;"><span style="font-size: x-small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>m_explorers.NewExplorer += new ExplorersEvents_NewExplorerEventHandler(OnNewExplorer);<o:p></o:p></span></span></p>
<p class="Code"><span style="font-family: Courier New;"><span style="font-size: x-small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>Explorer ActiveExplorer = Application.ActiveExplorer();<o:p></o:p></span></span></p>
<p class="Code"><span style="font-family: Courier New;"><span style="font-size: x-small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>if (ActiveExplorer != null)<o:p></o:p></span></span></p>
<p class="Code"><span style="font-family: Courier New;"><span style="font-size: x-small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>{<o:p></o:p></span></span></p>
<p class="Code"><span style="font-family: Courier New;"><span style="font-size: x-small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>ExplorerWrappers.Add(new ExplorerWrapper(ActiveExplorer));<o:p></o:p></span></span></p>
<p class="Code"><span style="font-family: Courier New;"><span style="font-size: x-small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>ActiveExplorer.SelectionChange += new ExplorerEvents_10_SelectionChangeEventHandler(OnActiveExplorerSelectionChange);<o:p></o:p></span></span></p>
<p class="Code"><span style="font-family: Courier New;"><span style="font-size: x-small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>}<o:p></o:p></span></span></p>
<p class="Code"><span style="font-family: Courier New;"><span style="font-size: x-small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>}<o:p></o:p></span></span></p>
<p class="Code"><o:p><span style="font-family: Courier New; font-size: x-small;">&nbsp;</span></o:p></p>
<p class="Code"><o:p><span style="font-family: Courier New; font-size: x-small;">&nbsp;</span></o:p></p>
<p class="Code"><span style="font-family: Courier New;"><span style="font-size: x-small;">You also need to do the same in the &ldquo;NewExplorer&rdquo; even handler like this.<o:p></o:p></span></span></p>
<p class="Code"><span style="font-family: Courier New;"><span style="font-size: x-small;">private void OnNewExplorer(Explorer Explorer)<o:p></o:p></span></span></p>
<p class="Code"><span style="font-family: Courier New;"><span style="font-size: x-small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>{<o:p></o:p></span></span></p>
<p class="Code"><o:p><span style="font-family: Courier New; font-size: x-small;">&nbsp;</span></o:p></p>
<p class="Code"><o:p><span style="font-family: Courier New; font-size: x-small;">&nbsp;</span></o:p></p>
<p class="Code"><span style="font-family: Courier New;"><span style="font-size: x-small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>//If new explorer is opened (in open new window) we add it to Wrapper<o:p></o:p></span></span></p>
<p class="Code"><span style="font-family: Courier New;"><span style="font-size: x-small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>//This is set the togggle state. GetPressed of Outlook m_ribbon will do the <o:p></o:p></span></span></p>
<p class="Code"><span style="font-family: Courier New;"><span style="font-size: x-small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>//actual toggling/untoggling <o:p></o:p></span></span></p>
<p class="Code"><span style="font-family: Courier New;"><span style="font-size: x-small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>Explorer.SelectionChange += new ExplorerEvents_10_SelectionChangeEventHandler(OnActiveExplorerSelectionChange);<o:p></o:p></span></span></p>
<p class="Code"><span style="font-family: Courier New;"><span style="font-size: x-small;"><span style="mso-spacerun: yes;">&nbsp;</span><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>ExplorerWrapper ExplorerWrapper = new ExplorerWrapper(Explorer);<o:p></o:p></span></span></p>
<p class="Code"><span style="font-family: Courier New;"><span style="font-size: x-small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>ExplorerWrappers.Add(ExplorerWrapper);<o:p></o:p></span></span></p>
<p class="Code"><o:p><span style="font-family: Courier New; font-size: x-small;">&nbsp;</span></o:p></p>
<p class="Code"><span style="font-family: Courier New;"><span style="font-size: x-small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>}<o:p></o:p></span></span></p>
<p class="Text"><o:p><span style="font-family: Verdana; font-size: x-small;">&nbsp;</span></o:p></p>
<p class="Text"><span style="font-size: x-small;"><span style="font-family: Verdana;">The wrapper object can now maintain the state information by using properties. The wrapper object is automatically removed from the collection by subscribing to the close event handler.<o:p></o:p></span></span></p>
<p class="Text"><span style="font-size: x-small;"><span style="font-family: Verdana;">The same pattern is applied for the inspector window. <b style="mso-bidi-font-weight: normal;"><o:p></o:p></b></span></span></p>
<p class="Text"><o:p><span style="font-family: Verdana; font-size: x-small;">&nbsp;</span></o:p></p>
<p class="Text"><o:p><span style="font-family: Verdana; font-size: x-small;">&nbsp;</span></o:p></p>
<h1 style="margin: 9pt 0in 3pt;"><a name="_Toc267325791"><span style="font-family: Verdana;">Using the Wrapper Objects in Ribbon</span></a><o:p></o:p></h1>
<p class="Text"><o:p><span style="font-family: Verdana; font-size: x-small;">&nbsp;</span></o:p></p>
<p class="Text"><span style="font-family: Verdana;"><span style="font-size: x-small;">These wrapper objects are used in the ribbon object while executing the callbacks. In our example when you click on the button &ldquo;EnableOrDiasbleAll&rdquo;, it will dynamically enable or disable all buttons. We do this by subscribing to the &ldquo;GetEnabled&rdquo; callback . This will be called when we call the Invalidate/Invalidate control method of the ribbon.<o:p></o:p></span></span></p>
<p class="Text"><span style="font-family: Verdana;"><span style="font-size: x-small;">We will use the wrapper object enable or disable appropriately. Given below is the code on the button that retrieves the active wrapper item that can store the Boolean value.<o:p></o:p></span></span></p>
<p class="Text"><span style="font-family: Verdana;"><span style="font-size: x-small;">To attach the callback function for the button you need to add the method name in the ribbon xml and the corresponding callback function in the ribbon class like this.<o:p></o:p></span></span></p>
<p class="Text"><o:p><span style="font-family: Verdana; font-size: x-small;">&nbsp;</span></o:p></p>
<p class="Code"><span style="font-family: Courier New;"><span style="font-size: x-small;"><span style="mso-spacerun: yes;">&nbsp; </span>&lt;<span style="color: #a31515;">toggleButton</span> <span style="color: red;">id</span>=<span style="color: windowtext;">"</span>toggleButton3<span style="color: windowtext;">"</span> <span style="color: red;">label</span>=<span style="color: windowtext;">"</span>EnableOrDiableAll<span style="color: windowtext;">"</span> <span style="color: red;">onAction</span>=<span style="color: windowtext;">"</span>OnEnableOrDisableAll<span style="color: windowtext;">"</span> <span style="color: red;">showImage</span>=<span style="color: windowtext;">"</span>false<span style="color: windowtext;">"</span> /&gt;<o:p></o:p></span></span></p>
<p class="Code"><span style="font-family: Courier New;"><span style="font-size: x-small;">public void OnEnableOrDisableAll(Office.IRibbonControl ctrl, bool isPressed)<o:p></o:p></span></span></p>
<p class="Code"><span style="font-family: Courier New;"><span style="font-size: x-small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>{<o:p></o:p></span></span></p>
<p class="Code"><span style="font-family: Courier New;"><span style="font-size: x-small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>dynamic ActiveWrapper = GetActiveOutlookWrapperItem();<o:p></o:p></span></span></p>
<p class="Code"><span style="font-family: Courier New;"><span style="font-size: x-small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>ActiveWrapper.IsButton1Enabled = isPressed;<o:p></o:p></span></span></p>
<p class="Code"><span style="font-family: Courier New;"><span style="font-size: x-small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>ActiveWrapper.IsButton2Enabled = isPressed;<o:p></o:p></span></span></p>
<p class="Code"><span style="font-family: Courier New;"><span style="font-size: x-small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>Globals.ThisAddIn.m_RibbonUI.InvalidateControl("toggleButton1");<o:p></o:p></span></span></p>
<p class="Code"><span style="font-family: Courier New;"><span style="font-size: x-small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>Globals.ThisAddIn.m_RibbonUI.InvalidateControl("normalButton1");<o:p></o:p></span></span></p>
<p class="Code"><span style="font-family: Courier New;"><span style="font-size: x-small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>}<o:p></o:p></span></span></p>
<p class="Text"><o:p><span style="font-family: Verdana; font-size: x-small;">&nbsp;</span></o:p></p>
<p class="Text"><span style="font-family: Verdana;"><span style="font-size: x-small;">You will set the &ldquo;IsButton1Enabled&rdquo; and &ldquo;IsButton2Enabled&rdquo; to true/false based on the toggle button action.<o:p></o:p></span></span></p>
<p class="Text"><span style="font-family: Verdana;"><span style="font-size: x-small;">The GetActiveOutlookWrapperItem will get the wrapper object for the active window. The code is shown below<o:p></o:p></span></span></p>
<p class="Code"><span style="font-family: Courier New;"><span style="font-size: x-small;">private static object GetActiveOutlookWrapperItem()<o:p></o:p></span></span></p>
<p class="Code"><span style="font-family: Courier New;"><span style="font-size: x-small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>{<o:p></o:p></span></span></p>
<p class="Code"><span style="font-family: Courier New;"><span style="font-size: x-small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>//Checks the active window<o:p></o:p></span></span></p>
<p class="Code"><span style="font-family: Courier New;"><span style="font-size: x-small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>object activeWindow;<o:p></o:p></span></span></p>
<p class="Code"><span style="font-family: Courier New;"><span style="font-size: x-small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>activeWindow = Globals.ThisAddIn.Application.ActiveWindow();<o:p></o:p></span></span></p>
<p class="Code"><span style="font-family: Courier New;"><span style="font-size: x-small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>//If it is exploer, set its background <o:p></o:p></span></span></p>
<p class="Code"><span style="font-family: Courier New;"><span style="font-size: x-small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>if (activeWindow is Microsoft.Office.Interop.Outlook.Explorer)<o:p></o:p></span></span></p>
<p class="Code"><span style="font-family: Courier New;"><span style="font-size: x-small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>{<o:p></o:p></span></span></p>
<p class="Code"><span style="font-family: Courier New;"><span style="font-size: x-small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;</span>ExplorerWrapper ExplorerWrapper = Globals.ThisAddIn.ExplorerWrappers.FirstOrDefault(explorer =&gt; explorer.Explorer == Globals.ThisAddIn.Application.ActiveExplorer());<o:p></o:p></span></span></p>
<p class="Code"><span style="font-family: Courier New;"><span style="font-size: x-small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>return ExplorerWrapper;<o:p></o:p></span></span></p>
<p class="Code"><span style="font-family: Courier New;"><span style="font-size: x-small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>}<o:p></o:p></span></span></p>
<p class="Code"><span style="font-family: Courier New;"><span style="font-size: x-small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>else if (activeWindow is Microsoft.Office.Interop.Outlook.Inspector)<o:p></o:p></span></span></p>
<p class="Code"><span style="font-family: Courier New;"><span style="font-size: x-small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>{<o:p></o:p></span></span></p>
<p class="Code"><span style="font-family: Courier New;"><span style="font-size: x-small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>InspectorWrapper InspectorWrapper = Globals.ThisAddIn.InspectorWrappers.FirstOrDefault(inspector =&gt; inspector.Inspector == Globals.ThisAddIn.Application.ActiveInspector());<o:p></o:p></span></span></p>
<p class="Code"><span style="font-family: Courier New;"><span style="font-size: x-small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>return InspectorWrapper;<o:p></o:p></span></span></p>
<p class="Code"><o:p><span style="font-family: Courier New; font-size: x-small;">&nbsp;</span></o:p></p>
<p class="Code"><span style="font-family: Courier New;"><span style="font-size: x-small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>}<o:p></o:p></span></span></p>
<p class="Code"><span style="font-family: Courier New;"><span style="font-size: x-small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>return null;<o:p></o:p></span></span></p>
<p class="Code"><span style="font-family: Courier New;"><span style="font-size: x-small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>}<o:p></o:p></span></span></p>
<p class="Text"><a name="_Toc244344298"></a><a name="_Toc244344252"></a><a name="_Toc244343837"></a><a name="_Toc244342965"></a><a name="_Toc244342784"><span style="mso-bookmark: _Toc244342965;"><span style="mso-bookmark: _Toc244343837;"><span style="mso-bookmark: _Toc244344252;"><span style="mso-bookmark: _Toc244344298;"><span style="font-size: x-small;"><span style="font-family: Verdana;">You need to subscribe the callback to the &ldquo;GetEnabled&rdquo; in the ribbon xml like this<o:p></o:p></span></span></span></span></span></span></a></p>
<p class="MsoNormal"><span style="mso-bookmark: _Toc244342784;"><span style="mso-bookmark: _Toc244342965;"><span style="mso-bookmark: _Toc244343837;"><span style="mso-bookmark: _Toc244344252;"><span style="mso-bookmark: _Toc244344298;"><span style="font-family: Consolas; color: blue; font-size: 9.5pt;">&lt;</span></span></span></span></span></span><span style="mso-bookmark: _Toc244342784;"><span style="mso-bookmark: _Toc244342965;"><span style="mso-bookmark: _Toc244343837;"><span style="mso-bookmark: _Toc244344252;"><span style="mso-bookmark: _Toc244344298;"><span style="font-family: Consolas; color: #a31515; font-size: 9.5pt;">toggleButton</span></span></span></span></span></span><span style="mso-bookmark: _Toc244342784;"><span style="mso-bookmark: _Toc244342965;"><span style="mso-bookmark: _Toc244343837;"><span style="mso-bookmark: _Toc244344252;"><span style="mso-bookmark: _Toc244344298;"><span style="font-family: Consolas; color: blue; font-size: 9.5pt;"> </span></span></span></span></span></span><span style="mso-bookmark: _Toc244342784;"><span style="mso-bookmark: _Toc244342965;"><span style="mso-bookmark: _Toc244343837;"><span style="mso-bookmark: _Toc244344252;"><span style="mso-bookmark: _Toc244344298;"><span style="font-family: Consolas; color: red; font-size: 9.5pt;">id</span></span></span></span></span></span><span style="mso-bookmark: _Toc244342784;"><span style="mso-bookmark: _Toc244342965;"><span style="mso-bookmark: _Toc244343837;"><span style="mso-bookmark: _Toc244344252;"><span style="mso-bookmark: _Toc244344298;"><span style="font-family: Consolas; color: blue; font-size: 9.5pt;">=</span></span></span></span></span></span><span style="mso-bookmark: _Toc244342784;"><span style="mso-bookmark: _Toc244342965;"><span style="mso-bookmark: _Toc244343837;"><span style="mso-bookmark: _Toc244344252;"><span style="mso-bookmark: _Toc244344298;"><span style="font-family: Consolas; color: windowtext; font-size: 9.5pt;">"</span></span></span></span></span></span><span style="mso-bookmark: _Toc244342784;"><span style="mso-bookmark: _Toc244342965;"><span style="mso-bookmark: _Toc244343837;"><span style="mso-bookmark: _Toc244344252;"><span style="mso-bookmark: _Toc244344298;"><span style="font-family: Consolas; color: blue; font-size: 9.5pt;">toggleButton1</span></span></span></span></span></span><span style="mso-bookmark: _Toc244342784;"><span style="mso-bookmark: _Toc244342965;"><span style="mso-bookmark: _Toc244343837;"><span style="mso-bookmark: _Toc244344252;"><span style="mso-bookmark: _Toc244344298;"><span style="font-family: Consolas; color: windowtext; font-size: 9.5pt;">"</span></span></span></span></span></span><span style="mso-bookmark: _Toc244342784;"><span style="mso-bookmark: _Toc244342965;"><span style="mso-bookmark: _Toc244343837;"><span style="mso-bookmark: _Toc244344252;"><span style="mso-bookmark: _Toc244344298;"><span style="font-family: Consolas; color: blue; font-size: 9.5pt;"> </span></span></span></span></span></span><span style="mso-bookmark: _Toc244342784;"><span style="mso-bookmark: _Toc244342965;"><span style="mso-bookmark: _Toc244343837;"><span style="mso-bookmark: _Toc244344252;"><span style="mso-bookmark: _Toc244344298;"><span style="font-family: Consolas; color: red; font-size: 9.5pt;">label</span></span></span></span></span></span><span style="mso-bookmark: _Toc244342784;"><span style="mso-bookmark: _Toc244342965;"><span style="mso-bookmark: _Toc244343837;"><span style="mso-bookmark: _Toc244344252;"><span style="mso-bookmark: _Toc244344298;"><span style="font-family: Consolas; color: blue; font-size: 9.5pt;">=</span></span></span></span></span></span><span style="mso-bookmark: _Toc244342784;"><span style="mso-bookmark: _Toc244342965;"><span style="mso-bookmark: _Toc244343837;"><span style="mso-bookmark: _Toc244344252;"><span style="mso-bookmark: _Toc244344298;"><span style="font-family: Consolas; color: windowtext; font-size: 9.5pt;">"</span></span></span></span></span></span><span style="mso-bookmark: _Toc244342784;"><span style="mso-bookmark: _Toc244342965;"><span style="mso-bookmark: _Toc244343837;"><span style="mso-bookmark: _Toc244344252;"><span style="mso-bookmark: _Toc244344298;"><span style="font-family: Consolas; color: blue; font-size: 9.5pt;">ToggleButton1</span></span></span></span></span></span><span style="mso-bookmark: _Toc244342784;"><span style="mso-bookmark: _Toc244342965;"><span style="mso-bookmark: _Toc244343837;"><span style="mso-bookmark: _Toc244344252;"><span style="mso-bookmark: _Toc244344298;"><span style="font-family: Consolas; color: windowtext; font-size: 9.5pt;">"</span></span></span></span></span></span><span style="mso-bookmark: _Toc244342784;"><span style="mso-bookmark: _Toc244342965;"><span style="mso-bookmark: _Toc244343837;"><span style="mso-bookmark: _Toc244344252;"><span style="mso-bookmark: _Toc244344298;"><span style="font-family: Consolas; color: blue; font-size: 9.5pt;"> </span></span></span></span></span></span><span style="mso-bookmark: _Toc244342784;"><span style="mso-bookmark: _Toc244342965;"><span style="mso-bookmark: _Toc244343837;"><span style="mso-bookmark: _Toc244344252;"><span style="mso-bookmark: _Toc244344298;"><span style="font-family: Consolas; color: red; font-size: 9.5pt;">showImage</span></span></span></span></span></span><span style="mso-bookmark: _Toc244342784;"><span style="mso-bookmark: _Toc244342965;"><span style="mso-bookmark: _Toc244343837;"><span style="mso-bookmark: _Toc244344252;"><span style="mso-bookmark: _Toc244344298;"><span style="font-family: Consolas; color: blue; font-size: 9.5pt;">=</span></span></span></span></span></span><span style="mso-bookmark: _Toc244342784;"><span style="mso-bookmark: _Toc244342965;"><span style="mso-bookmark: _Toc244343837;"><span style="mso-bookmark: _Toc244344252;"><span style="mso-bookmark: _Toc244344298;"><span style="font-family: Consolas; color: windowtext; font-size: 9.5pt;">"</span></span></span></span></span></span><span style="mso-bookmark: _Toc244342784;"><span style="mso-bookmark: _Toc244342965;"><span style="mso-bookmark: _Toc244343837;"><span style="mso-bookmark: _Toc244344252;"><span style="mso-bookmark: _Toc244344298;"><span style="font-family: Consolas; color: blue; font-size: 9.5pt;">false</span></span></span></span></span></span><span style="mso-bookmark: _Toc244342784;"><span style="mso-bookmark: _Toc244342965;"><span style="mso-bookmark: _Toc244343837;"><span style="mso-bookmark: _Toc244344252;"><span style="mso-bookmark: _Toc244344298;"><span style="font-family: Consolas; color: windowtext; font-size: 9.5pt;">"</span></span></span></span></span></span><span style="mso-bookmark: _Toc244342784;"><span style="mso-bookmark: _Toc244342965;"><span style="mso-bookmark: _Toc244343837;"><span style="mso-bookmark: _Toc244344252;"><span style="mso-bookmark: _Toc244344298;"><span style="font-family: Consolas; color: blue; font-size: 9.5pt;"> </span></span></span></span></span></span><span style="mso-bookmark: _Toc244342784;"><span style="mso-bookmark: _Toc244342965;"><span style="mso-bookmark: _Toc244343837;"><span style="mso-bookmark: _Toc244344252;"><span style="mso-bookmark: _Toc244344298;"><span style="font-family: Consolas; color: red; font-size: 9.5pt;">getEnabled</span></span></span></span></span></span><span style="mso-bookmark: _Toc244342784;"><span style="mso-bookmark: _Toc244342965;"><span style="mso-bookmark: _Toc244343837;"><span style="mso-bookmark: _Toc244344252;"><span style="mso-bookmark: _Toc244344298;"><span style="font-family: Consolas; color: blue; font-size: 9.5pt;">=</span></span></span></span></span></span><span style="mso-bookmark: _Toc244342784;"><span style="mso-bookmark: _Toc244342965;"><span style="mso-bookmark: _Toc244343837;"><span style="mso-bookmark: _Toc244344252;"><span style="mso-bookmark: _Toc244344298;"><span style="font-family: Consolas; color: windowtext; font-size: 9.5pt;">"</span></span></span></span></span></span><span style="mso-bookmark: _Toc244342784;"><span style="mso-bookmark: _Toc244342965;"><span style="mso-bookmark: _Toc244343837;"><span style="mso-bookmark: _Toc244344252;"><span style="mso-bookmark: _Toc244344298;"><span style="font-family: Consolas; color: blue; font-size: 9.5pt;">GetEnabled</span></span></span></span></span></span><span style="mso-bookmark: _Toc244342784;"><span style="mso-bookmark: _Toc244342965;"><span style="mso-bookmark: _Toc244343837;"><span style="mso-bookmark: _Toc244344252;"><span style="mso-bookmark: _Toc244344298;"><span style="font-family: Consolas; color: windowtext; font-size: 9.5pt;">"</span></span></span></span></span></span><span style="mso-bookmark: _Toc244342784;"><span style="mso-bookmark: _Toc244342965;"><span style="mso-bookmark: _Toc244343837;"><span style="mso-bookmark: _Toc244344252;"><span style="mso-bookmark: _Toc244344298;"><span style="font-family: Consolas; color: blue; font-size: 9.5pt;"> </span></span></span></span></span></span><span style="mso-bookmark: _Toc244342784;"><span style="mso-bookmark: _Toc244342965;"><span style="mso-bookmark: _Toc244343837;"><span style="mso-bookmark: _Toc244344252;"><span style="mso-bookmark: _Toc244344298;"><span style="font-family: Consolas; color: red; font-size: 9.5pt;">onAction</span></span></span></span></span></span><span style="mso-bookmark: _Toc244342784;"><span style="mso-bookmark: _Toc244342965;"><span style="mso-bookmark: _Toc244343837;"><span style="mso-bookmark: _Toc244344252;"><span style="mso-bookmark: _Toc244344298;"><span style="font-family: Consolas; color: blue; font-size: 9.5pt;">=</span></span></span></span></span></span><span style="mso-bookmark: _Toc244342784;"><span style="mso-bookmark: _Toc244342965;"><span style="mso-bookmark: _Toc244343837;"><span style="mso-bookmark: _Toc244344252;"><span style="mso-bookmark: _Toc244344298;"><span style="font-family: Consolas; color: windowtext; font-size: 9.5pt;">"</span></span></span></span></span></span><span style="mso-bookmark: _Toc244342784;"><span style="mso-bookmark: _Toc244342965;"><span style="mso-bookmark: _Toc244343837;"><span style="mso-bookmark: _Toc244344252;"><span style="mso-bookmark: _Toc244344298;"><span style="font-family: Consolas; color: blue; font-size: 9.5pt;">OnToggleButton1Click</span></span></span></span></span></span><span style="mso-bookmark: _Toc244342784;"><span style="mso-bookmark: _Toc244342965;"><span style="mso-bookmark: _Toc244343837;"><span style="mso-bookmark: _Toc244344252;"><span style="mso-bookmark: _Toc244344298;"><span style="font-family: Consolas; color: windowtext; font-size: 9.5pt;">"</span></span></span></span></span></span><span style="mso-bookmark: _Toc244342784;"><span style="mso-bookmark: _Toc244342965;"><span style="mso-bookmark: _Toc244343837;"><span style="mso-bookmark: _Toc244344252;"><span style="mso-bookmark: _Toc244344298;"><span style="font-family: Consolas; color: blue; font-size: 9.5pt;"> </span></span></span></span></span></span><span style="mso-bookmark: _Toc244342784;"><span style="mso-bookmark: _Toc244342965;"><span style="mso-bookmark: _Toc244343837;"><span style="mso-bookmark: _Toc244344252;"><span style="mso-bookmark: _Toc244344298;"><span style="font-family: Consolas; color: red; font-size: 9.5pt;">getPressed</span></span></span></span></span></span><span style="mso-bookmark: _Toc244342784;"><span style="mso-bookmark: _Toc244342965;"><span style="mso-bookmark: _Toc244343837;"><span style="mso-bookmark: _Toc244344252;"><span style="mso-bookmark: _Toc244344298;"><span style="font-family: Consolas; color: blue; font-size: 9.5pt;">=</span></span></span></span></span></span><span style="mso-bookmark: _Toc244342784;"><span style="mso-bookmark: _Toc244342965;"><span style="mso-bookmark: _Toc244343837;"><span style="mso-bookmark: _Toc244344252;"><span style="mso-bookmark: _Toc244344298;"><span style="font-family: Consolas; color: windowtext; font-size: 9.5pt;">"</span></span></span></span></span></span><span style="mso-bookmark: _Toc244342784;"><span style="mso-bookmark: _Toc244342965;"><span style="mso-bookmark: _Toc244343837;"><span style="mso-bookmark: _Toc244344252;"><span style="mso-bookmark: _Toc244344298;"><span style="font-family: Consolas; color: blue; font-size: 9.5pt;">GetPressed</span></span></span></span></span></span><span style="mso-bookmark: _Toc244342784;"><span style="mso-bookmark: _Toc244342965;"><span style="mso-bookmark: _Toc244343837;"><span style="mso-bookmark: _Toc244344252;"><span style="mso-bookmark: _Toc244344298;"><span style="font-family: Consolas; color: windowtext; font-size: 9.5pt;">"</span></span></span></span></span></span><span style="mso-bookmark: _Toc244342784;"><span style="mso-bookmark: _Toc244342965;"><span style="mso-bookmark: _Toc244343837;"><span style="mso-bookmark: _Toc244344252;"><span style="mso-bookmark: _Toc244344298;"><span style="font-family: Consolas; color: blue; font-size: 9.5pt;"> /&gt;</span></span></span></span></span></span><span style="mso-bookmark: _Toc244342784;"><span style="mso-bookmark: _Toc244342965;"><span style="mso-bookmark: _Toc244343837;"><span style="mso-bookmark: _Toc244344252;"><span style="mso-bookmark: _Toc244344298;"><span style="font-family: Consolas; color: windowtext; font-size: 9.5pt;"><o:p></o:p></span></span></span></span></span></span></p>
<p class="MsoNormal"><span style="mso-bookmark: _Toc244342784;"><span style="mso-bookmark: _Toc244342965;"><span style="mso-bookmark: _Toc244343837;"><span style="mso-bookmark: _Toc244344252;"><span style="mso-bookmark: _Toc244344298;"><span style="font-family: Consolas; color: blue; font-size: 9.5pt;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>&lt;</span></span></span></span></span></span><span style="mso-bookmark: _Toc244342784;"><span style="mso-bookmark: _Toc244342965;"><span style="mso-bookmark: _Toc244343837;"><span style="mso-bookmark: _Toc244344252;"><span style="mso-bookmark: _Toc244344298;"><span style="font-family: Consolas; color: #a31515; font-size: 9.5pt;">button</span></span></span></span></span></span><span style="mso-bookmark: _Toc244342784;"><span style="mso-bookmark: _Toc244342965;"><span style="mso-bookmark: _Toc244343837;"><span style="mso-bookmark: _Toc244344252;"><span style="mso-bookmark: _Toc244344298;"><span style="font-family: Consolas; color: blue; font-size: 9.5pt;"> </span></span></span></span></span></span><span style="mso-bookmark: _Toc244342784;"><span style="mso-bookmark: _Toc244342965;"><span style="mso-bookmark: _Toc244343837;"><span style="mso-bookmark: _Toc244344252;"><span style="mso-bookmark: _Toc244344298;"><span style="font-family: Consolas; color: red; font-size: 9.5pt;">id</span></span></span></span></span></span><span style="mso-bookmark: _Toc244342784;"><span style="mso-bookmark: _Toc244342965;"><span style="mso-bookmark: _Toc244343837;"><span style="mso-bookmark: _Toc244344252;"><span style="mso-bookmark: _Toc244344298;"><span style="font-family: Consolas; color: blue; font-size: 9.5pt;">=</span></span></span></span></span></span><span style="mso-bookmark: _Toc244342784;"><span style="mso-bookmark: _Toc244342965;"><span style="mso-bookmark: _Toc244343837;"><span style="mso-bookmark: _Toc244344252;"><span style="mso-bookmark: _Toc244344298;"><span style="font-family: Consolas; color: windowtext; font-size: 9.5pt;">"</span></span></span></span></span></span><span style="mso-bookmark: _Toc244342784;"><span style="mso-bookmark: _Toc244342965;"><span style="mso-bookmark: _Toc244343837;"><span style="mso-bookmark: _Toc244344252;"><span style="mso-bookmark: _Toc244344298;"><span style="font-family: Consolas; color: blue; font-size: 9.5pt;">normalButton1</span></span></span></span></span></span><span style="mso-bookmark: _Toc244342784;"><span style="mso-bookmark: _Toc244342965;"><span style="mso-bookmark: _Toc244343837;"><span style="mso-bookmark: _Toc244344252;"><span style="mso-bookmark: _Toc244344298;"><span style="font-family: Consolas; color: windowtext; font-size: 9.5pt;">"</span></span></span></span></span></span><span style="mso-bookmark: _Toc244342784;"><span style="mso-bookmark: _Toc244342965;"><span style="mso-bookmark: _Toc244343837;"><span style="mso-bookmark: _Toc244344252;"><span style="mso-bookmark: _Toc244344298;"><span style="font-family: Consolas; color: blue; font-size: 9.5pt;"> </span></span></span></span></span></span><span style="mso-bookmark: _Toc244342784;"><span style="mso-bookmark: _Toc244342965;"><span style="mso-bookmark: _Toc244343837;"><span style="mso-bookmark: _Toc244344252;"><span style="mso-bookmark: _Toc244344298;"><span style="font-family: Consolas; color: red; font-size: 9.5pt;">label</span></span></span></span></span></span><span style="mso-bookmark: _Toc244342784;"><span style="mso-bookmark: _Toc244342965;"><span style="mso-bookmark: _Toc244343837;"><span style="mso-bookmark: _Toc244344252;"><span style="mso-bookmark: _Toc244344298;"><span style="font-family: Consolas; color: blue; font-size: 9.5pt;">=</span></span></span></span></span></span><span style="mso-bookmark: _Toc244342784;"><span style="mso-bookmark: _Toc244342965;"><span style="mso-bookmark: _Toc244343837;"><span style="mso-bookmark: _Toc244344252;"><span style="mso-bookmark: _Toc244344298;"><span style="font-family: Consolas; color: windowtext; font-size: 9.5pt;">"</span></span></span></span></span></span><span style="mso-bookmark: _Toc244342784;"><span style="mso-bookmark: _Toc244342965;"><span style="mso-bookmark: _Toc244343837;"><span style="mso-bookmark: _Toc244344252;"><span style="mso-bookmark: _Toc244344298;"><span style="font-family: Consolas; color: blue; font-size: 9.5pt;">NormalButton1</span></span></span></span></span></span><span style="mso-bookmark: _Toc244342784;"><span style="mso-bookmark: _Toc244342965;"><span style="mso-bookmark: _Toc244343837;"><span style="mso-bookmark: _Toc244344252;"><span style="mso-bookmark: _Toc244344298;"><span style="font-family: Consolas; color: windowtext; font-size: 9.5pt;">"</span></span></span></span></span></span><span style="mso-bookmark: _Toc244342784;"><span style="mso-bookmark: _Toc244342965;"><span style="mso-bookmark: _Toc244343837;"><span style="mso-bookmark: _Toc244344252;"><span style="mso-bookmark: _Toc244344298;"><span style="font-family: Consolas; color: blue; font-size: 9.5pt;"> </span></span></span></span></span></span><span style="mso-bookmark: _Toc244342784;"><span style="mso-bookmark: _Toc244342965;"><span style="mso-bookmark: _Toc244343837;"><span style="mso-bookmark: _Toc244344252;"><span style="mso-bookmark: _Toc244344298;"><span style="font-family: Consolas; color: red; font-size: 9.5pt;">showImage</span></span></span></span></span></span><span style="mso-bookmark: _Toc244342784;"><span style="mso-bookmark: _Toc244342965;"><span style="mso-bookmark: _Toc244343837;"><span style="mso-bookmark: _Toc244344252;"><span style="mso-bookmark: _Toc244344298;"><span style="font-family: Consolas; color: blue; font-size: 9.5pt;">=</span></span></span></span></span></span><span style="mso-bookmark: _Toc244342784;"><span style="mso-bookmark: _Toc244342965;"><span style="mso-bookmark: _Toc244343837;"><span style="mso-bookmark: _Toc244344252;"><span style="mso-bookmark: _Toc244344298;"><span style="font-family: Consolas; color: windowtext; font-size: 9.5pt;">"</span></span></span></span></span></span><span style="mso-bookmark: _Toc244342784;"><span style="mso-bookmark: _Toc244342965;"><span style="mso-bookmark: _Toc244343837;"><span style="mso-bookmark: _Toc244344252;"><span style="mso-bookmark: _Toc244344298;"><span style="font-family: Consolas; color: blue; font-size: 9.5pt;">false</span></span></span></span></span></span><span style="mso-bookmark: _Toc244342784;"><span style="mso-bookmark: _Toc244342965;"><span style="mso-bookmark: _Toc244343837;"><span style="mso-bookmark: _Toc244344252;"><span style="mso-bookmark: _Toc244344298;"><span style="font-family: Consolas; color: windowtext; font-size: 9.5pt;">"</span></span></span></span></span></span><span style="mso-bookmark: _Toc244342784;"><span style="mso-bookmark: _Toc244342965;"><span style="mso-bookmark: _Toc244343837;"><span style="mso-bookmark: _Toc244344252;"><span style="mso-bookmark: _Toc244344298;"><span style="font-family: Consolas; color: blue; font-size: 9.5pt;"> </span></span></span></span></span></span><span style="mso-bookmark: _Toc244342784;"><span style="mso-bookmark: _Toc244342965;"><span style="mso-bookmark: _Toc244343837;"><span style="mso-bookmark: _Toc244344252;"><span style="mso-bookmark: _Toc244344298;"><span style="font-family: Consolas; color: red; font-size: 9.5pt;">getEnabled</span></span></span></span></span></span><span style="mso-bookmark: _Toc244342784;"><span style="mso-bookmark: _Toc244342965;"><span style="mso-bookmark: _Toc244343837;"><span style="mso-bookmark: _Toc244344252;"><span style="mso-bookmark: _Toc244344298;"><span style="font-family: Consolas; color: blue; font-size: 9.5pt;">=</span></span></span></span></span></span><span style="mso-bookmark: _Toc244342784;"><span style="mso-bookmark: _Toc244342965;"><span style="mso-bookmark: _Toc244343837;"><span style="mso-bookmark: _Toc244344252;"><span style="mso-bookmark: _Toc244344298;"><span style="font-family: Consolas; color: windowtext; font-size: 9.5pt;">"</span></span></span></span></span></span><span style="mso-bookmark: _Toc244342784;"><span style="mso-bookmark: _Toc244342965;"><span style="mso-bookmark: _Toc244343837;"><span style="mso-bookmark: _Toc244344252;"><span style="mso-bookmark: _Toc244344298;"><span style="font-family: Consolas; color: blue; font-size: 9.5pt;">GetEnabled</span></span></span></span></span></span><span style="mso-bookmark: _Toc244342784;"><span style="mso-bookmark: _Toc244342965;"><span style="mso-bookmark: _Toc244343837;"><span style="mso-bookmark: _Toc244344252;"><span style="mso-bookmark: _Toc244344298;"><span style="font-family: Consolas; color: windowtext; font-size: 9.5pt;">"</span></span></span></span></span></span><span style="mso-bookmark: _Toc244342784;"><span style="mso-bookmark: _Toc244342965;"><span style="mso-bookmark: _Toc244343837;"><span style="mso-bookmark: _Toc244344252;"><span style="mso-bookmark: _Toc244344298;"><span style="font-family: Consolas; color: blue; font-size: 9.5pt;"> </span></span></span></span></span></span><span style="mso-bookmark: _Toc244342784;"><span style="mso-bookmark: _Toc244342965;"><span style="mso-bookmark: _Toc244343837;"><span style="mso-bookmark: _Toc244344252;"><span style="mso-bookmark: _Toc244344298;"><span style="font-family: Consolas; color: red; font-size: 9.5pt;">onAction</span></span></span></span></span></span><span style="mso-bookmark: _Toc244342784;"><span style="mso-bookmark: _Toc244342965;"><span style="mso-bookmark: _Toc244343837;"><span style="mso-bookmark: _Toc244344252;"><span style="mso-bookmark: _Toc244344298;"><span style="font-family: Consolas; color: blue; font-size: 9.5pt;">=</span></span></span></span></span></span><span style="mso-bookmark: _Toc244342784;"><span style="mso-bookmark: _Toc244342965;"><span style="mso-bookmark: _Toc244343837;"><span style="mso-bookmark: _Toc244344252;"><span style="mso-bookmark: _Toc244344298;"><span style="font-family: Consolas; color: windowtext; font-size: 9.5pt;">"</span></span></span></span></span></span><span style="mso-bookmark: _Toc244342784;"><span style="mso-bookmark: _Toc244342965;"><span style="mso-bookmark: _Toc244343837;"><span style="mso-bookmark: _Toc244344252;"><span style="mso-bookmark: _Toc244344298;"><span style="font-family: Consolas; color: blue; font-size: 9.5pt;">OnNormalButton1Click</span></span></span></span></span></span><span style="mso-bookmark: _Toc244342784;"><span style="mso-bookmark: _Toc244342965;"><span style="mso-bookmark: _Toc244343837;"><span style="mso-bookmark: _Toc244344252;"><span style="mso-bookmark: _Toc244344298;"><span style="font-family: Consolas; color: windowtext; font-size: 9.5pt;">"</span></span></span></span></span></span><span style="mso-bookmark: _Toc244342784;"><span style="mso-bookmark: _Toc244342965;"><span style="mso-bookmark: _Toc244343837;"><span style="mso-bookmark: _Toc244344252;"><span style="mso-bookmark: _Toc244344298;"><span style="font-family: Consolas; color: blue; font-size: 9.5pt;"> /&gt;<o:p></o:p></span></span></span></span></span></span></p>
<p class="Text"><span style="mso-bookmark: _Toc244342784;"><span style="mso-bookmark: _Toc244342965;"><span style="mso-bookmark: _Toc244343837;"><span style="mso-bookmark: _Toc244344252;"><span style="mso-bookmark: _Toc244344298;"><o:p><span style="font-family: Verdana; font-size: x-small;">&nbsp;</span></o:p></span></span></span></span></span></p>
<p><span style="mso-bookmark: _Toc244344298;"></span><span style="mso-bookmark: _Toc244344252;"></span><span style="mso-bookmark: _Toc244343837;"></span><span style="mso-bookmark: _Toc244342965;"></span><span style="mso-bookmark: _Toc244342784;"></span></p>
<p class="Text"><a name="_Toc260278140"><span style="font-family: Verdana;"><span style="font-size: x-small;">When you call the invalidate/invalidate control method of the ribbon it will execute the &ldquo;GetEnabled&rdquo; callback function. We will use the wrapper object in this callback to return the appropriate Boolean value. This callback will be repeatedly called for all registered buttons.<o:p></o:p></span></span></a></p>
<p class="Text"><span style="mso-bookmark: _Toc260278140;"><span style="font-family: Verdana;"><span style="font-size: x-small;">Given below is the code which does this.<b style="mso-bidi-font-weight: normal;"><o:p></o:p></b></span></span></span></p>
<h3 style="margin: 10pt 0in 0pt;"><span style="mso-bookmark: _Toc260278140;"><span style="color: black; font-weight: normal; mso-bidi-font-weight: bold;"><o:p><span style="font-family: Cambria; font-size: x-small;">&nbsp;</span></o:p></span></span></h3>
<p class="Code"><span style="mso-bookmark: _Toc260278140;"><span style="font-family: Courier New;"><span style="font-size: x-small;">public bool GetEnabled(Office.IRibbonControl ctrl)<o:p></o:p></span></span></span></p>
<p class="Code"><span style="mso-bookmark: _Toc260278140;"><span style="font-family: Courier New;"><span style="font-size: x-small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>{<o:p></o:p></span></span></span></p>
<p class="Code"><span style="mso-bookmark: _Toc260278140;"><o:p><span style="font-family: Courier New; font-size: x-small;">&nbsp;</span></o:p></span></p>
<p class="Code"><span style="mso-bookmark: _Toc260278140;"><span style="font-family: Courier New;"><span style="font-size: x-small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>if (ctrl == null)<o:p></o:p></span></span></span></p>
<p class="Code"><span style="mso-bookmark: _Toc260278140;"><span style="font-family: Courier New;"><span style="font-size: x-small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>return false;<o:p></o:p></span></span></span></p>
<p class="Code"><span style="mso-bookmark: _Toc260278140;"><span style="font-family: Courier New;"><span style="font-size: x-small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>object context = ctrl.Context;<o:p></o:p></span></span></span></p>
<p class="Code"><span style="mso-bookmark: _Toc260278140;"><span style="font-family: Courier New;"><span style="font-size: x-small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>dynamic activeWindow = GetActiveOutlookWrapperItem();<o:p></o:p></span></span></span></p>
<p class="Code"><span style="mso-bookmark: _Toc260278140;"><span style="font-family: Courier New;"><span style="font-size: x-small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>if (ctrl.Id == "toggleButton1")<o:p></o:p></span></span></span></p>
<p class="Code"><span style="mso-bookmark: _Toc260278140;"><span style="font-family: Courier New;"><span style="font-size: x-small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>{<o:p></o:p></span></span></span></p>
<p class="Code"><span style="mso-bookmark: _Toc260278140;"><span style="font-family: Courier New;"><span style="font-size: x-small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>return activeWindow.IsButton1Enabled;<o:p></o:p></span></span></span></p>
<p class="Code"><span style="mso-bookmark: _Toc260278140;"><span style="font-family: Courier New;"><span style="font-size: x-small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>}<o:p></o:p></span></span></span></p>
<p class="Code"><span style="mso-bookmark: _Toc260278140;"><span style="font-family: Courier New;"><span style="font-size: x-small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>else if (ctrl.Id == "normalButton1")<o:p></o:p></span></span></span></p>
<p class="Code"><span style="mso-bookmark: _Toc260278140;"><span style="font-family: Courier New;"><span style="font-size: x-small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>{<o:p></o:p></span></span></span></p>
<p class="Code"><span style="mso-bookmark: _Toc260278140;"><span style="font-family: Courier New;"><span style="font-size: x-small;"><span style="mso-spacerun: yes;">&nbsp;</span><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>return activeWindow.IsButton2Enabled;<o:p></o:p></span></span></span></p>
<p class="Code"><span style="mso-bookmark: _Toc260278140;"><span style="font-family: Courier New;"><span style="font-size: x-small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><o:p></o:p></span></span></span></p>
<p class="Code"><span style="mso-bookmark: _Toc260278140;"><span style="font-family: Courier New;"><span style="font-size: x-small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>}<o:p></o:p></span></span></span></p>
<p class="Code"><span style="mso-bookmark: _Toc260278140;"><span style="font-family: Courier New;"><span style="font-size: x-small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>return true;<o:p></o:p></span></span></span></p>
<p class="Code"><span style="mso-bookmark: _Toc260278140;"><span style="font-family: Courier New;"><span style="font-size: x-small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>}<o:p></o:p></span></span></span></p>
<p class="Code"><span style="mso-bookmark: _Toc260278140;"><o:p><span style="font-family: Courier New; font-size: x-small;">&nbsp;</span></o:p></span></p>
<p class="Text"><span style="mso-bookmark: _Toc260278140;"><o:p><span style="font-family: Verdana; font-size: x-small;">&nbsp;</span></o:p></span></p>
<p><span style="mso-bookmark: _Toc260278140;"></span></p>
<p class="MsoNormal"><o:p><span style="font-family: Verdana; font-size: x-small;">&nbsp;</span></o:p></p>
<h1 style="margin: 9pt 0in 3pt;"><a name="_Toc267325792"><span style="mso-font-kerning: 0pt;"><span style="font-family: Verdana;">Running the Sample</span></span></a><o:p></o:p></h1>
<p class="Text"><span style="font-size: x-small;"><span style="font-family: Verdana;">To run the sample <b style="mso-bidi-font-weight: normal;"><o:p></o:p></b></span></span></p>
<p class="Text"><span style="mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana;"><span style="mso-list: Ignore;"><span style="font-family: Verdana; font-size: x-small;">1.</span><span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-family: Verdana; font-size: x-small;">Download the code from </span><a href="https://cid-69d9fec9f0fc367a.office.live.com/browse.aspx/RibbonStateManagement?permissionsChanged=1&amp;groupUpsell=0"><span style="font-family: Verdana; font-size: x-small;">here</span></a><span style="font-size: x-small;"><span style="font-family: Verdana;"> <o:p></o:p></span></span></p>
<p class="Text"><span style="mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana;"><span style="mso-list: Ignore;"><span style="font-family: Verdana; font-size: x-small;">2.</span><span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: x-small;"><span style="font-family: Verdana;">Close the outlook 2010<o:p></o:p></span></span></p>
<p class="Text"><span style="mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana;"><span style="mso-list: Ignore;"><span style="font-family: Verdana; font-size: x-small;">3.</span><span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: x-small;"><span style="font-family: Verdana;">Build the sample project and then press F5 to launch the Outlook 2010<o:p></o:p></span></span></p>
<p class="Text"><span style="mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana;"><span style="mso-list: Ignore;"><span style="font-family: Verdana; font-size: x-small;">4.</span><span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: x-small;"><span style="font-family: Verdana;">Click on the ribbon tab &ldquo;CustomTab&rdquo;<o:p></o:p></span></span></p>
<p class="Text"><span style="mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana;"><span style="mso-list: Ignore;"><span style="font-family: Verdana; font-size: x-small;">5.</span><span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: x-small;"><span style="font-family: Verdana;">Click on the button &ldquo;EnableOrDisableAll&rdquo;<o:p></o:p></span></span></p>
<p class="Text"><span style="font-size: x-small;"><span style="font-family: Verdana;">This will disable all buttons. Open a new email and click on the ribbon tab &ldquo;CustomTab&rdquo; and verify that the button controls in this ribbon are not affected.<o:p></o:p></span></span></p>
<h1 style="margin: 9pt 0in 3pt;"><a name="_Toc267325793"><span style="mso-font-kerning: 0pt; mso-bidi-font-weight: bold;"><span style="font-family: Verdana;">Additional Resources</span></span></a><span style="mso-font-kerning: 0pt; mso-bidi-font-weight: bold;"><o:p></o:p></span></h1>
<p class="MsoNormal"><a href="https://msdn.microsoft.com/en-us/library/ee692172.aspx"><span style="font-family: Verdana; font-size: x-small;">https://msdn.microsoft.com/en-us/library/ee692172.aspx</span></a><o:p></o:p></p>]]></content:encoded>
    </item>
    <item>
      <title>How to improve the performance of word automation for large amounts of data.</title>
      <link>https://docs.microsoft.com/archive/blogs/anilkumar/how-to-improve-the-performance-of-word-automation-for-large-amounts-of-data</link>
      <pubDate>Wed, 14 Jul 2010 11:04:00 GMT</pubDate>
      <dc:creator><![CDATA[AnilKumar_bhaskara]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/anilkumar/2010/07/14/how-to-improve-the-performance-of-word-automation-for-large-amounts-of-data/</guid>
      <description><![CDATA[It&rsquo;s often the case for a VSTO developer (add-in developer) to insert the data into a...]]></description>
      <content:encoded><![CDATA[<p><span style="font-family: Calibri;">
<p class="MsoNormal"><span style="font-size: small;">It&rsquo;s often the case for a VSTO developer (add-in developer) to insert the data into a document. VSTO and Word object model is great to achieve this one. If the amount of data being inserted is large then word automation can be slow. I have authored an MSDN article with our colleagues (Ansari, Sarang Datye and Sunil Kumar) at Microsoft that addresses this scenario. <o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size: small;">The interesting aspect is this article explains the usage of Open Xml even when the document is open for editing. Here is the </span><a href="https://msdn.microsoft.com/en-us/library/ff191178.aspx"><span style="font-size: small;">link</span></a><span style="font-size: small;"> to the complete article.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size: small;">Special thanks to </span><a href="https://blogs.msdn.com/b/ericwhite"><span style="color: #0000ff; font-size: small;">Eric White</span></a><span style="font-size: small;"> for providing his insights and&nbsp;review. <o:p></o:p></span></p>
<span style="font-family: Calibri;">
<p class="MsoNormal">&nbsp;</p>
</span></span>
<p class="MsoNormal">&nbsp;</p>
</p>
<p class="MsoNormal">&nbsp;</p>]]></content:encoded>
    </item>
  </channel>
</rss>