Back in April, Susan Joly and I discussed applying agile principles to samples development and delivery. This first project was designed to learn how to apply agile principles to samples development while hopefully delivering something of value to you, the customer. After identifying OutlookSyncSQL as our first sample agile project based on a large number of MSDN votes, I defined and published the initial user stories. During the past few months, I published a few iterations that build upon each other. This final iteration, and accompanying code, address most of my initial user stories. I decided to remove 2 user stories as they were out of scope. Iteration 4 (I4) is the final iteration for our Agile Samples Development pilot project. I4 uses MVVM concepts and a SyncWorkflow to illustrate how to decouple parts of client code in a model and workflow.

To help illustrate the progression of this sample, I created a step diagram.

image

 

Final User Stories

1. As an Outlook user, I want to synchronize contact fields to a SQL database. (Iteration 2)

2. As an Outlook user, I am occasionally disconnected from the network / internet. Therefore, I need my contacts available while offline. (Iteration 2)

3. As a user, I want my contacts automatically synchronized with a SQL Server or SQL Azure contact table. (Iteration 3)

4. As a user, I want to be able to easily configure the sample application. (Iteration 4)

5. As an administrator, I need to allow a list of specific users to read/write to a specific SQL table during a synchronization session. (Decided to remove this user story)

6. As a user, I want to easily install, and cleanly un-install the Contact Sync Addin. (Iteration 4)

7. As an Outlook user, I want to see the progress of an Outlook / contacts table synchronization. (Iteration 3, Iteration 4 using MVVM and Workflow)

8. As an Outlook user, I want to view a history of synchronization values. (Decided to remove this user story)

9. As a user, all of my existing contacts must be preserved while and after running the sample. (Iteration 2)

Iteration 4 shows how to invoke a Windows Workflow 4.0 workflow containing a SyncModel extension from Outlook. In addition, the WPF user control hosted in a custom task pane using MVVM. The sample workflow uses notify activities to notify the model the the workflow has started, updated the model and completed. See Windows Workflow Foundation (WF4) - How to use Workflow from WPF for more information about using workflow with WPF. Enabling the sync sample in Outlook is as simple as dragging the NotifySyncUpdatedActivity onto a Sequence activity and setting a few InArguments. Using MVVM and workflow code activities decouples the code from a host such as Outlook. The SyncWorkflow example could be used with any client.

Example SyncWorkflow ran from Outlook

The sample Workflow Designer that can be opened from Outlook. Or you can use the VS.NET 2010 and above workflow designer. The custom workflow designer built into Outlook shows how to self host a workflow designer that runs code activities such as the NotifySyncUpdatedActivity.

Sample SyncWorkflow:

You can download Outlook Contact Data Sync Iteration 4 from this site.

We are very interested to learn from you how we can apply agile development principles to delivery effective samples. We are learning as we go, and your sample’s needs and feedback can greatly help use. The core of our agile sample projects is to better connect with customers.

How to install the sample

1. Attach AdventureWorks2012 to a SQL Server Express or above instance. See How to install AdventureWorksLT2012_SyncSample database.

2. Attach AdventureWorks_localdb_2012 to (localdb)\v11.0. See How to install AdventureWorksLT2012_localdb_SyncSample database on SQL Express LocalDB.

3. Open the OutlookSyncSQL.sln solution.

4. Provision SQL Server Synchronization. See How to configure the sample SQL Server Synchronization.

5. Start the Solution. This will register the Outlook Addin and start Outlook.

Optional – Enable Outlook Sync by creating a Sync workflow

1. Copy \OutlookSyncSQL\SyncClientWorkflow\Workflow\BlankWorkflow\SyncWorkflow.xaml to \OutlookSyncSQL\SyncClientWorkflow\Workflow\.

2. From Outlook, click the Contacts folder.

image

3. Click the SQL Server Samples ribbon tab.

4. Click the Designer button which loads the sample workflow designer.

image

5. Drag a NotifyStartedActivity from the activity toolbox onto the empty Sequence activity.

image

6. Drag a NotifySyncUpdatedActivity under the NotifyStartedActivity.

7. Select the NotifySyncUpdatedActivity and set the following properties in the Activity PropertyGrid:

ClientDataSource

“Data Source=(localdb)\v11.0;Initial Catalog=AdventureWorksLT2012_localdb_SyncSample;Integrated Security=True”

ScopeName

Select ContactsScope from the ComboBox dropdown.

ServerDataSource

“Data Source=.;Initial Catalog=AdventureWorksLT2012_SyncSample;Integrated Security=True;Connect Timeout=1

8. Drag a NotifyCompletedActivity below the NotifySyncUpdatedActivity.

9. Close the designer window. For the sample, the workflow will auto-save.

Final SyncWorkflow

image

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 OutlookSyncSQL_Iteration_4.zip.

2. From the License Agreement, click I Agree.

3. From File Download, click Save and browse to a location on your desktop.

4. Unzip OutlookSyncSQL.zip and copy \Database\AdventureWorksLT2012_SyncSample_Data.mdf to a folder.

5. From SQL Server Management Studio, execute the following T-SQL 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).

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

How to install AdventureWorksLT2012_localdb_SyncSample database on SQL Express LocalDB

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

To install AdventureWorksLT2012_localdb_SyncSample database

1. Unzip OutlookSyncSQL.zip and copy \Database\AdventureWorksLT2012_localdb_SyncSample.mdf to a folder.

2. From SQL Server Management Studio, connect to (localdb)\v11.0 as the Server name, and execute the following T-SQL code:

CREATE DATABASE AdventureWorksLT2012_localdb_SyncSample ON (FILENAME = '{drive}:\{file path}\AdventureWorksLT2012_localdb_SyncSample') 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).

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 the sample

To run iteration 4, 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 click on the Outlook Contacts folder.

Steps

1. From the SQL Server Samples ribbon, click the SQL Server Sync Task Pane button.

2. Make a few changes to the sample contacts.

3. On the Sync Sample task pane, click the Sync button.

Note If a “Cannot create unknown type '{clr-namespace: Microsoft.Samples.SqlServer.SyncClientWorkflow}NotifyStarted'” exception is thrown, then modify the xmlns:local attribute within SyncWorkflow.xaml by appending ;assembly=Microsoft.Samples.SqlServer.SyncClientWorkflow.

xmlns:local attribute

xmlns:local="clr-namespace:Microsoft.Samples.SqlServer.SyncClientWorkflow;assembly=Microsoft.Samples.SqlServer.SyncClientWorkflow"

Last edited Jul 20, 2012 at 10:38 PM by DerrickVMSFT, version 1

Comments

No comments yet.