<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Coding for Office Accounting : Business Logic Add-in</title><link>http://blogs.msdn.com/martha/archive/tags/Business+Logic+Add-in/default.aspx</link><description>Tags: Business Logic Add-in</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Moving SBA SDK 1.0 Add-ins to SBA SDK 2.0 (Office Accounting 2007)</title><link>http://blogs.msdn.com/martha/archive/2006/10/18/moving-sba-sdk-1-0-add-ins-to-sba-sdk-2-0-office-accounting-2007.aspx</link><pubDate>Wed, 18 Oct 2006 21:25:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:840210</guid><dc:creator>martha</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/martha/comments/840210.aspx</comments><wfw:commentRss>http://blogs.msdn.com/martha/commentrss.aspx?PostID=840210</wfw:commentRss><description>&lt;P&gt;The next version of &lt;A class="" href="http://www.microsoft.com/downloads/details.aspx?familyid=2dae9876-27b4-4103-97b4-4cd1d6c809d4&amp;amp;displaylang=en" target=_blank mce_href="http://www.microsoft.com/downloads/details.aspx?familyid=2dae9876-27b4-4103-97b4-4cd1d6c809d4&amp;amp;displaylang=en"&gt;SBA SDK&lt;/A&gt; is coming (under a different product name) and it's time to start looking at some of the changes in the Add-ins area.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Referencing SBAAPI.dll&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;First of all, we found out that our 1.0 SDK sample for UIAddIn, we were referencing SBAAPI (when we are always telling you not to do it).&amp;nbsp;So now that 2.0 is coming I can show you why this is bad. The problem with this is that it references the v1 sbaapi.dll which is not going to be there for 2.0, so if you try to install this add-in in our 2.0 product you will get the following error when you try to click on the "Invoices" button.&lt;/P&gt;
&lt;P&gt;&lt;IMG style="WIDTH: 929px; HEIGHT: 126px" height=126 src="http://martha.members.winisp.net/images/AddInReferencingSBAAPI.PNG" width=929 mce_src="http://martha.members.winisp.net/images/AddInReferencingSBAAPI.PNG"&gt;&lt;/P&gt;
&lt;P&gt;If you don't want your add-in to work with Office Accounting 2007 then this is ok, but in case you do, here is what you need to do to remove the reference to SBAAPI.&lt;BR&gt;&lt;STRONG&gt;1.&lt;/STRONG&gt; In the UIAddIn project, remove the reference to SBAAPI.&lt;BR&gt;&lt;STRONG&gt;2.&lt;/STRONG&gt; You'll get the following build error:&lt;/P&gt;
&lt;P&gt;CustomerInvoices.cs(63): The type or namespace name 'CustomerAccount' could not be found (are you missing a using directive or an assembly reference?)&lt;/P&gt;
&lt;P&gt;The problem goes away if you use the ICustomerAccount instead of the CustomerAccount class that exists in SBAAPI. Here is the corrected line of code:&lt;/P&gt;&lt;FONT color=#0000ff size=2&gt;
&lt;P&gt;this&lt;/FONT&gt;&lt;FONT size=2&gt;.customerName = ((ICustomerAccount)smallBusinessInstance.CustomerAccounts.GetByPrimaryKey(customerID)).Name;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2&gt;This&amp;nbsp;problem has&amp;nbsp;been fixed in our SBA SDK 2.0. You can find the SBA SDK 2.0 beta &lt;A class="" href="http://connect.microsoft.com/OfficeAccountingBeta/Downloads/DownloadDetails.aspx?DownloadID=1814" target=_blank mce_href="http://connect.microsoft.com/OfficeAccountingBeta/Downloads/DownloadDetails.aspx?DownloadID=1814"&gt;here&lt;/A&gt;.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2&gt;&lt;STRONG&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2&gt;&lt;STRONG&gt;Business Logic Add-ins&lt;/STRONG&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2&gt;If you tried using my sample code from my ISdkAddInDriver Sample that I posted in &lt;A class="" href="http://blogs.msdn.com/martha/archive/2006/07/16/667639.aspx" mce_href="http://blogs.msdn.com/martha/archive/2006/07/16/667639.aspx"&gt;C#&lt;/A&gt; or in &lt;A class="" href="http://blogs.msdn.com/martha/archive/2006/10/02/SBA-Business-Logic-Add_2D00_in-Sample-in-VB.NET-_2800_ISdkAddInDriver_2900_.aspx" mce_href="http://blogs.msdn.com/martha/archive/2006/10/02/SBA-Business-Logic-Add_2D00_in-Sample-in-VB.NET-_2800_ISdkAddInDriver_2900_.aspx"&gt;VB.NET&lt;/A&gt;, there are changes that you need to make if you want to remove the reference to SBAAPI.dll. If you want to do validation, you need to throw an ApplicationException instead of a SmallBusinessException, for example the new code will be:&lt;/FONT&gt;&lt;FONT size=2&gt; 
&lt;P&gt;&lt;STRONG&gt;C# -&amp;gt;&lt;/STRONG&gt; &lt;FONT color=#0000ff size=2&gt;throw&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;new&lt;/FONT&gt;&lt;FONT size=2&gt; ApplicationException("EMAIL MISSING");&lt;BR&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;STRONG&gt;VB.NET -&amp;gt;&lt;/STRONG&gt; &lt;FONT color=#0000ff size=2&gt;Throw&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;New&lt;/FONT&gt;&lt;FONT size=2&gt; ApplicationException("EMAIL MISSING")&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;/P&gt;
&lt;P&gt;&lt;FONT size=2&gt;One of the improvements we've made for Office Accounting 2007 in validation is the error message that users will see when the business logic add-in throws an ApplicationException.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2&gt;In Small Business Accounting 2006 you will see this:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2&gt;&lt;IMG style="WIDTH: 371px; HEIGHT: 192px" height=192 src="http://martha.members.winisp.net/images/BusinessLogicAddInV1.PNG" width=371 mce_src="http://martha.members.winisp.net/images/BusinessLogicAddInV1.PNG"&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2&gt;In Office Accounting 2007 you will see this:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2&gt;&lt;IMG style="WIDTH: 360px; HEIGHT: 165px" height=165 src="http://martha.members.winisp.net/images/BusinessLogicAddInV2.PNG" width=360 mce_src="http://martha.members.winisp.net/images/BusinessLogicAddInV2.PNG"&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2&gt;As you can see, the error message now is shorter and more helpful. First, we show the Add-in name and we show whatever Message the Add-in specifies in the ApplicationException. You can find Office Accounting 2007 beta &lt;A class="" href="http://connect.microsoft.com/OfficeAccountingBeta" target=_blank mce_href="http://connect.microsoft.com/OfficeAccountingBeta"&gt;here&lt;/A&gt;.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2&gt;&lt;STRONG&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2&gt;&lt;STRONG&gt;UI Add-ins&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2&gt;One of the improvements we made here is the ability to have cascading menus (up to 3 levels), so now you can organize your menus better. We have updated the UI Add-in sample in SBA SDK 2.0 to show cascading menus. You can find the SBA SDK 2.0 beta &lt;A class="" href="http://connect.microsoft.com/OfficeAccountingBeta/Downloads/DownloadDetails.aspx?DownloadID=1814" target=_blank mce_href="http://connect.microsoft.com/OfficeAccountingBeta/Downloads/DownloadDetails.aspx?DownloadID=1814"&gt;here&lt;/A&gt;.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2&gt;&lt;IMG style="WIDTH: 537px; HEIGHT: 123px" height=123 src="http://martha.members.winisp.net/images/CascadingMenus.PNG" width=537 mce_src="http://martha.members.winisp.net/images/CascadingMenus.PNG"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2&gt;&amp;nbsp;&lt;/P&gt;&lt;/FONT&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=840210" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/martha/archive/tags/SBA+AddIns/default.aspx">SBA AddIns</category><category domain="http://blogs.msdn.com/martha/archive/tags/ISdkAddInDriver/default.aspx">ISdkAddInDriver</category><category domain="http://blogs.msdn.com/martha/archive/tags/Business+Logic+Add-in/default.aspx">Business Logic Add-in</category><category domain="http://blogs.msdn.com/martha/archive/tags/Office+Accounting/default.aspx">Office Accounting</category><category domain="http://blogs.msdn.com/martha/archive/tags/IUIAddInDriver/default.aspx">IUIAddInDriver</category></item><item><title>SBA Business Logic Add-in Sample in VB.NET (ISdkAddInDriver)</title><link>http://blogs.msdn.com/martha/archive/2006/10/02/SBA-Business-Logic-Add_2D00_in-Sample-in-VB.NET-_2800_ISdkAddInDriver_2900_.aspx</link><pubDate>Mon, 02 Oct 2006 19:42:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:781215</guid><dc:creator>martha</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/martha/comments/781215.aspx</comments><wfw:commentRss>http://blogs.msdn.com/martha/commentrss.aspx?PostID=781215</wfw:commentRss><description>&lt;P&gt;A couple months ago I posted a step by step process for doing a Business Logic Add-in Sample in C#, so finally here is the second part for doing this in VB.NET. The instructions are pretty much copied from the &lt;A class="" href="http://blogs.msdn.com/martha/archive/2006/07/16/667639.aspx" target=_blank mce_href="http://blogs.msdn.com/martha/archive/2006/07/16/667639.aspx"&gt;original post&lt;/A&gt; but I have translated the code to VB and verified it.&lt;/P&gt;
&lt;P&gt;Let's start.&lt;/P&gt;
&lt;P&gt;1. Open the UIAddIn project (from VB.NET Samples)&lt;BR&gt;2. Add a new class that implements the &lt;STRONG&gt;ISdkAddInDriver&lt;/STRONG&gt; interface. I got the basic code from the Concepts Manual of our SDK. I'm going to post the code here:&lt;/P&gt;
&lt;DIV class=code&gt;&lt;FONT color=blue&gt;Imports&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&gt;Microsoft.BusinessSolutions.SmallBusinessAccounting&lt;BR&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=blue&gt;Public&amp;nbsp;Class&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&gt;BusinessLogic&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;Implements&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&gt;ISdkAddInDriver&lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;Private&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&gt;m_contextObject&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;As&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&gt;IBaseMasterEntity&lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;Private&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&gt;instance&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;As&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&gt;ISmallBusinessInstance&lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;Public&amp;nbsp;Sub&amp;nbsp;New&lt;/FONT&gt;&lt;FONT color=black&gt;(&lt;/FONT&gt;&lt;FONT color=blue&gt;ByVal&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&gt;contextObject&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;As&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&gt;IBaseMasterEntity)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;MyBase&lt;/FONT&gt;&lt;FONT color=black&gt;.&lt;/FONT&gt;&lt;FONT color=blue&gt;New&lt;/FONT&gt;&lt;FONT color=black&gt;()&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;Me&lt;/FONT&gt;&lt;FONT color=black&gt;.m_contextObject&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;=&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&gt;contextObject&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;Me&lt;/FONT&gt;&lt;FONT color=black&gt;.instance&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;=&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&gt;contextObject.SmallBusinessInstance&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;End&amp;nbsp;Sub&lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Public&amp;nbsp;ReadOnly&amp;nbsp;Property&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&gt;ContextObject()&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;As&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&gt;IBaseMasterEntity&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;Get&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Return&amp;nbsp;Me&lt;/FONT&gt;&lt;FONT color=black&gt;.m_contextObject&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;End&amp;nbsp;Get&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;End&amp;nbsp;Property&lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Public&amp;nbsp;Sub&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&gt;RunPreSave()&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;Implements&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&gt;ISdkAddInDriver.RunPreSave&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=darkgreen&gt;'&amp;nbsp;Do&amp;nbsp;Pre-Save&amp;nbsp;work&amp;nbsp;here&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;End&amp;nbsp;Sub&lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Public&amp;nbsp;Sub&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&gt;RunPostSave()&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;Implements&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&gt;ISdkAddInDriver.RunPostSave&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=darkgreen&gt;'&amp;nbsp;Do&amp;nbsp;Post-Save&amp;nbsp;work&amp;nbsp;here&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;End&amp;nbsp;Sub&lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Public&amp;nbsp;Sub&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&gt;RunPreDelete()&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;Implements&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&gt;ISdkAddInDriver.RunPreDelete&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=darkgreen&gt;'&amp;nbsp;Do&amp;nbsp;Pre-Delete&amp;nbsp;work&amp;nbsp;here&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;End&amp;nbsp;Sub&lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Public&amp;nbsp;Sub&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&gt;RunPostDelete()&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;Implements&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&gt;ISdkAddInDriver.RunPostDelete&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=darkgreen&gt;'&amp;nbsp;Do&amp;nbsp;Post-Delete&amp;nbsp;work&amp;nbsp;here&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;End&amp;nbsp;Sub&lt;BR&gt;End&amp;nbsp;Class&lt;/FONT&gt; &lt;/DIV&gt;
&lt;P&gt;3. Now we need to hook the business logic addin so it can be registered and instantiated by SBA. Here's what I have to do: &lt;/P&gt;
&lt;P&gt;In DriverRegistration.vb we need to return a new myDriverInfo for the business logic addin. I added this code in line 37 (in the&amp;nbsp;GetDriverInfos method)&amp;nbsp;&lt;/P&gt;
&lt;DIV class=code&gt;&lt;FONT color=black&gt;myDriverInfo&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;=&amp;nbsp;New&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&gt;MyDriverInfo(&lt;/FONT&gt;&lt;FONT color=blue&gt;New&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&gt;Guid(&lt;/FONT&gt;&lt;FONT color=#808080&gt;"6EF926D5-79B8-476e-8847-3AE0BCCBF28F"&lt;/FONT&gt;&lt;FONT color=black&gt;),&amp;nbsp;DriverType.SdkAddIn,&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;False&lt;/FONT&gt;&lt;FONT color=black&gt;,&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#808080&gt;""&lt;/FONT&gt;&lt;FONT color=black&gt;,&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#808080&gt;"Validate&amp;nbsp;Customer&amp;nbsp;Email&amp;nbsp;Business&amp;nbsp;Logic&amp;nbsp;Addin"&lt;/FONT&gt;&lt;FONT color=black&gt;,&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#808080&gt;"This&amp;nbsp;is&amp;nbsp;a&amp;nbsp;test&amp;nbsp;business&amp;nbsp;logic&amp;nbsp;to&amp;nbsp;validate&amp;nbsp;email&amp;nbsp;on&amp;nbsp;customers."&lt;/FONT&gt;&lt;FONT color=black&gt;,&amp;nbsp;Guid.Empty,&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;GetType&lt;/FONT&gt;&lt;FONT color=black&gt;(BusinessLogic).FullName)&lt;BR&gt;&lt;BR&gt;driverInfo.Add(myDriverInfo)&lt;/FONT&gt; &lt;/DIV&gt;
&lt;P&gt;I'm just creating a new guid because I will only have one business logic on this assembly. The last parameter uses BusinessLogic which is the name of my class implementing the ISdkAddInDriver.&lt;/P&gt;
&lt;P&gt;In DriverRegistration.vb I need to instantiate my business logic addin. I change the LoadSdkAddInDriver to return a new instance of my BusinessLogic class. This is my new implementation:&lt;/P&gt;
&lt;DIV class=code&gt;&lt;FONT color=blue&gt;Public&amp;nbsp;Function&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&gt;LoadSdkAddInDriver(&lt;/FONT&gt;&lt;FONT color=blue&gt;ByVal&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&gt;driverGuid&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;As&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&gt;Guid,&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;ByVal&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&gt;ownerEntity&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;As&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&gt;IBaseMasterEntity)&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;As&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&gt;ISdkAddInDriver&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;Implements&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&gt;IDriverFactory.LoadSdkAddInDriver&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;Return&amp;nbsp;New&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&gt;BusinessLogic(ownerEntity)&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=blue&gt;End&amp;nbsp;Function&lt;/FONT&gt; &lt;/DIV&gt;
&lt;P&gt;Finally, in MyDriverInfo.vb we need to support the AppliedTypes property. In this case, I'm simple going to change the property directly just to make this addin work.&lt;/P&gt;
&lt;DIV class=code&gt;&lt;FONT color=blue&gt;Public&amp;nbsp;ReadOnly&amp;nbsp;Property&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&gt;AppliedTypes()&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;As&amp;nbsp;Type&lt;/FONT&gt;&lt;FONT color=black&gt;()&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;Implements&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&gt;IDriverInfo.AppliedTypes&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;Get&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Return&amp;nbsp;New&amp;nbsp;Type&lt;/FONT&gt;&lt;FONT color=black&gt;()&amp;nbsp;{&lt;/FONT&gt;&lt;FONT color=blue&gt;GetType&lt;/FONT&gt;&lt;FONT color=black&gt;(ICustomerAccount)}&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;End&amp;nbsp;Get&lt;BR&gt;End&amp;nbsp;Property&lt;/FONT&gt; &lt;/DIV&gt;
&lt;P&gt;4. I'm going to put a simple validation for customers so we can test this business logic addin. If the addin wants to cancel the save event (from the PreSave handler), it needs to throw an exception. The message shown to the user will be an ugly technical message, so I would personally suggest to show a friendly message before that. Here is my code:&lt;/P&gt;
&lt;DIV class=code&gt;&lt;BR&gt;&lt;FONT color=blue&gt;Public&amp;nbsp;Sub&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&gt;RunPreSave()&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;Implements&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&gt;ISdkAddInDriver.RunPreSave&lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;Dim&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&gt;customer&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;As&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&gt;ICustomerAccount&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;=&amp;nbsp;CType&lt;/FONT&gt;&lt;FONT color=black&gt;(ContextObject,&amp;nbsp;ICustomerAccount)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;Dim&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&gt;email&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;As&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&gt;ICustomerVendorEmail&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;=&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&gt;customer.CustomerVendorEmails.GetByType(CustomerVendorEmailType.Email1)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;If&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&gt;((email.EmailAddress&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;=&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&gt;Nothing)&amp;nbsp;_&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;OrElse&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&gt;(email.EmailAddress.Length&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;=&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=maroon&gt;0&lt;/FONT&gt;&lt;FONT color=black&gt;))&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;Then&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Throw&amp;nbsp;New&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&gt;SmallBusinessException(ErrorCases.EmailTypeInvalid,&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#808080&gt;"EMAIL&amp;nbsp;MISSING"&lt;/FONT&gt;&lt;FONT color=black&gt;)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;End&amp;nbsp;If&lt;BR&gt;End&amp;nbsp;Sub&lt;/FONT&gt; &lt;/DIV&gt;
&lt;P&gt;&lt;STRONG&gt;Gotchas&lt;BR&gt;&lt;/STRONG&gt;Each time you modify the code in the UIAddIn project, the assembly version will change so you would need to reinstall you addin again or change the AssemblyInfo.cs to have a fixed version number. This was the only issue I ran into. Then,&amp;nbsp;I just have to copy the UIAddin.dll to the SBA location and install it. If you were to ship a business logic, I would suggest you add it to your GAC and install in a separate folder.&lt;/P&gt;
&lt;P&gt;You can download my sample &lt;A class="" href="http://martha.members.winisp.net/samples/BusinessLogicAddinVB.zip" target=_blank mce_href="http://martha.members.winisp.net/samples/BusinessLogicAddinVB.zip"&gt;here&lt;/A&gt;.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=781215" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/martha/archive/tags/SBA+AddIns/default.aspx">SBA AddIns</category><category domain="http://blogs.msdn.com/martha/archive/tags/Office+Small+Business+Accounting/default.aspx">Office Small Business Accounting</category><category domain="http://blogs.msdn.com/martha/archive/tags/ISdkAddInDriver/default.aspx">ISdkAddInDriver</category><category domain="http://blogs.msdn.com/martha/archive/tags/Business+Logic+Add-in/default.aspx">Business Logic Add-in</category><category domain="http://blogs.msdn.com/martha/archive/tags/Office+Accounting/default.aspx">Office Accounting</category></item></channel></rss>