Outlook Contacts Sync SQL Server – Iteration 3 User Stories

  1. As a user, I want my contacts synchronized with a SQL Server or SQL Azure contact table.
  2. As an Outlook user, I want to see the statistics of an Outlook / contacts table synchronization.

How to install OutlookSyncSQL Iteration 3

  • Install SqlLocaLDB.MSI 64 bit or SqlLocaLDB.MSI 32 bit.
    • For SqlLocaLDB.MSI 64 bit, download ENU\x64\SqlLocalDB.MSI on the Microsoft® SQL Server® 2012 Express page.
    • For SqlLocaLDB.MSI 32 bit, download ENU\x86\SqlLocaLDB.MSI on the Microsoft® SQL Server® 2012 Express page.
  • To connect to LocalDB, install .NET Framework 4 Update 4.0.2.
  • Install AdventureWorksLT2012_SyncSample database

How to install AdventureWorksLT2012_SyncSample database

The AdventureWorksLT2012_SyncSample database can be installed using the CREATE DATABASE statement or by attaching the database.

To install AdventureWorksLT2012_SyncSample database

  1. Download .
  2. From the License Agreement, click I Agree.
  3. From File Download, click Save and browse to a location on your desktop.
  4. Unzip and copy \Database\AdventureWorksLT2012_SyncSample_Data.mdf to a folder.
  5. From SQL Server Management Studio, execute the following code:

CREATE DATABASE AdventureWorksLT2012_SyncSample ON (FILENAME = '{drive}:\{file path}\AdventureWorksLT2012_SyncSample_Data.mdf’) FOR ATTACH_REBUILD_LOG;

As an alternative to step 4, you can attach the database using the SQL Server Management Studio user interface. For more detailed information, see Attach a Database (SQL Server Management Studio) .


You must remove the log file from the list of files to attach. This will cause the operation to rebuild the log.

How to configure the sample SQL Server Synchronization

To configure the sample SQL Server Synchronization, run the SyncFrameworkUnitTest.ProvisionServerScope() test method then the SyncFrameworkUnitTest.ProvisionClientScope()test method.

How to run Iteration 3

To run iteration 3, open OutlookSyncSQL.sln in Visual Studio 2010 and run the sample. Once the solution opens Outlook, you will see a *SQL Server Samples* ribbon tab when you navigate to your Outlook Contacts folder. Click the Sync Task Pane ribbon button to toggle the Outlook Sync Sample task pane.

Note The sample source project will install the OutlookSyncSQLAddin Outlook 2010 add-in.


Synchronization Unit Tests

The following unit tests are defined within the SyncFrameworkUnitTest class.


The ProvisionServerScope() test method defines a sync scope and provisions the AdventureWorksLT2012_SyncSample sample database on a SQL Server instance with scope related artifacts. A sync scope, you define what you want to synchronize. A sync scope is a set of tables that must be synchronized as a single unit. OutlookSyncSQL Iteration 3 defines a ProductsScope containing [SalesLT].[Customer], [SalesLT].[CustomerAddress], [SalesLT].[Address].

For more information, see Walkthrough: Defining Scope and Provisioning a Server.



The ProvisionClientScope() test method provisions AdventureWorksLT2012_localdb_SyncSample with ProductsScope artifacts from the SQL Server instance. Note that you connect to a LocalDB database using (localdb)\v11.0 as the Server Name.

For more information, see Walkthrough: Provisioning a SQL Compact Client. The OutlookSyncSQL sample was modified from this walkthrough to use SQL Express LocalDB.



The Synchronize() method creates a sync orchestrator that synchronizes LocalDB AdventureWorksLT2012 and SQL Server AdventureWorksLT2012. The OutlookSyncSQL sample manually kicks off the synchronization process.

For more information, see Walkthrough: Executing Synchronization.


Last edited Jun 12, 2012 at 5:56 PM by DerrickVMSFT, version 9


DerrickVMSFT Jul 11, 2012 at 3:18 AM 
The previous iteration has been uploaded.

DerrickVMSFT Jul 11, 2012 at 12:48 AM 
I will upload the previous iteration tomorrow. Thank you for your feedback.

Steelynx Jul 6, 2012 at 2:02 PM 
Where can I find the source code from previous iterations? I would really like to work through this sample step by step and it would be very useful to see the code as it was when the documents where written.