Outlook Integration Sample

For the past few months, I’ve been heavily involved in a project but I wasn’t allowed to blog about it. Last week, it went live on MSDN so finally the gag is off.

About a year ago, word started to surface about something called Project Elixir which aimed to integrate back end CRM systems with Microsoft Outlook. Part of that effort resulted in the addition of Outlook Managed Add-ins to Visual Studio 2005 Tools for Office. However, the VSTO team’s primary deliverable was an add-in loader that enforced security, enabled shutdown unloading and provided a better startup/shutdown developer experience that IDTExtensibility2. (Check out the VSTO Outlook Architecture document for more details.) While those are important fundamentals that needed to be gotten right, VSTO Outlook doesn’t provide much in the way of tools or guidance for building Outlook add-ins that leverage managed forms and controls or integrate with your back end systems. That’s where the CRM Integration for Outlook sample comes in.

What we’ve built is a sample application that surfaces CRM style data inside of Outlook. Outlook is the natural home for your calendar and your personal contacts. Why not make it the natural home for your customer contacts, activities and opportunities as well? As part of the demo project we’ve implemented:

  • Using Windows Forms for editing custom items. Check out this screenshot. The Activity form is a standard managed Windows Forms form, not an Outlook custom form.
  • Using a Windows Forms user control as a folder home page. Here’s a screenshot of the “CRM Today” page. Again, that’s a standard managed Windows Forms user control.
  • A framework for adding menu items and toolbars. In Outlook, the developer has to manage adding the custom toolbars and menu to each explorer and inspector window themselves. With our sample, we built a framework to handle that for you.
  • Using SQL Express as a local cache of CRM data. It turns out that for many scenarios, storing a copy of all the back-end data directly in Outlook is a bad idea. First, it increases the size of the users mailbox, requiring more storage on the Exchange server. Furthermore, any custom data in Outlook has to be synced twice – once from the back end system to Outlook on the desktop, then from Outlook back to Exchange. By minimizing the amount of back-end data stored in Outlook proper, we reduce the mailbox size and sync bandwidth needs. In both the above screenshots, the displayed data is coming out of the local SQL Express instance, not Outlook.
  • Having two separate storage locations (Outlook & SQL Express) means having to sync between them. We’ve built a local sync engine that can sync both individual items between Outlook and SQL Express as well as a collection of items between SQL Express and a given Outlook folder.
  • Finally, there are some utility classes to make it easier to deal with Outlook folders and items. Of primary note is the ItemAdapter class which provides a pseudo base class for Outlook items (appointments, emails, tasks, etc). Those items all have a set of similar properties and methods, but don’t have a common base class so they can’t be treated polymorphicaly. ItemAdapter uses runtime reflection to implement those common operations without needing to cast to the concrete Outlook item type.

Check out the Architecture Design Guide, as well as the Outlook Customization Guide and the Local Sync Engine Guide up on the Solution Architecture Center. You can also pick up the source code. Also, I spun up a GDN Workspace so we can have a discussion forum and to track bugs and requests.

Going forward, I’m going to be focusing on the remote data sync story for this scenario. Among other responsibilities, I “own” the Data pillar of our Connected Systems model so this dovetails nicely. You’ll note above that while we have a local sync engine in the sample, we don’t have any way to move the data back and forth between the local copy in SQL Express and the remote copy in the CRM back-end. We are working on some guidance around this right now, but we didn’t want to hold up publishing the rest of the sample.

Frankly, it’s been nice to be involved with something so technical after spending time on the marketing team. I’m pretty proud of the project and I look forward to your feedback.

Update: Removed the link to the running demo as it’s been taken off the download site for reasons I am not aware of. If you want the binary and you don’t know how to compile it, drop me a mail.

Deploying Databases with SQL Server Express

Things have been quiet around here lately because I’ve been heads down on a dev project. We (that is to say, I) reached code complete today, so look for more posts shortly. But I wanted to quickly post a few things on deploying application that use SQLServer Express. It turns out that there are some significant differences between SSE and it’s older sibling with respect to Xcopy deployment.

First off, go read this article on Xcopy deployment and this article on User Instances. And while you’re out surfing, download SSEUtil – it’s a great little command line utility (i.e. no installer) that you can use to list, detach, attach, and create SSE databases.

Anyway, one of the MAJOR changes (and the one that gave my installer fits all day) is this idea of user or child instances of SSE. From the docs:

The user instance, also known as a child or client instance, is an instance of SQL Server that is generated by the parent instance (the primary instance running as a service, such as SQLExpress) on behalf of a user. The user instance runs as a user process under the security context of that user. The user instance is isolated from the parent instance and any other user instances running on the machine. The user instance feature is also referred to as “Run As Normal User” (RANU).

This is a big deal because essentially you have 2 instance of SSE running – the main one and the user specific one. And they’re different. I was totally confused by this because I didn’t realize it was happening. I created a new DB in .sqlexpress with VS but then it wouldn’t show up when I listed the databases with SSEUtil. The reason is the SSEUtil defaults to the child instance while creating a new DB with VS defaults to the main instance.

This is particularly relevant if you want to use the AttachDBFilename feature. I’m using SSE as a cache, so I wanted to put it in the <username>Application Data folder. But I couldn’t get the main instance of SSE to attach to a database in that folder tree. It drove me batty! I literally would move the DB from folder to folder – it works fine in My Docs, but not in App Data. However, it works fine from the child instance – I’m guessing that’s on purpose.

So my installer puts the DB file in the <username>App Data folder (as per Keith’s book) and changed my connection string to include the parameter “user instance=true”. Also, if you’re using AttachDBFilename, you need to include the initial catalog or database parameter, but without a value. In other words “Initial Catalog=”. Weird. But it worked like a charm.

Suggestions on Digital Audio Programming

Anybody have any suggestions of book and/or sites with information about programming with digital audio? I primarily care about mixing and fading, but also some effects and changing the playback speed without effecting the pitch. Feel free to leave comments or email me.

Dave is Pimping his Ride

I’m pretty excited to read about my friend David White building his own in-car navigation and entertainment system. He took a look at available systems and came away with the following opinions:

The problem with all these [existing systems] is three fold as far as I am concerned: 1) they are way too expensive, 2) they are not extendable (meaning I can’t program on them), and 3) they are not connected to the car. Imagine the last two put together!

<snip>

So what exactly is my thought? I mean there are people shoving Mac Minis and mini-ITX form factors in cars now right? Yes they are, but to me it is wrong tool for the job and just not that interesting (I would love to hear if you think I am wrong). I think there are problems with power consumption and conversion, instant on and off scenarios, dash placement, etc. So I thought to go out and build my own system. I mean build my own system -from the ground up board and all. Add a flip out screen with a wiring harness into the car bus network and away I go. I plan on using Windows mobile 5.0 and the .Net Compact Framework for the UI of applications and part way down the stack until the real time requirements outstrip what a garbage collected environment can do.

I’ve always had a hankering for learning embedded development, so I’ll be following David’s blog with great interest. I also love the title of his blog – Architect Must Implement.

TinyCLR and Invisible Computing

When I was at PDC, I saw the Phidgets folks in the Coding4Fun booth. Is it just me, or is this stuff dying to get merged with MSR’s Invisible Computing project? Haven’t heard of Invisible Computing? Here’s the description:

This site has the source code and documentation for Microsoft Invisible Computing. It is a research prototype for making small devices part of the seamless computing world. This site contains the source code and is available free of charge for research and educational use under the Microsoft Shared Source License.

Microsoft Invisible Computing consists of compact middleware for constructing embedded web services applications and a small component based Real-Time Operating System with TCP/IP networking to make middleware run straight on the metal on several embedded processors.

The goal is to make it easy to build custom smart devices and consumer electronics, especially battery operated; and to support research in invisible computing, operating systems, networking, ubiquitous computing, sensor nets, distributed systems, object-oriented design, and wireless communication.

FYI, I discovered the Invisible Computing project by searching the web for TinyCLR. TinyCLR is what powers the MSN Direct watch. From what I can tell (i.e. this is based on publicly discovered info) is that Invisible Computing is a shared source version of TinyCLR that works with a variety of hardware platforms. Sort of like a Rotor for embedded devices.

Check out a presentation and the code.