Recently one of our customers requested a SharePoint task list that is synchronized with Outlook. That is usually quite easy, but in this case we should have provided a way to tag the tasks and group them based on this multi-value property on the Outlook side, similarly to the default Categories field feature.
As you may know, only a limited set of task properties are synchronized between SharePoint and Outlook, but details – like what exactly these properties are and how the synchronization process works – are not very well documented.
To investigate the behavior I’ve created a test list called OLTasks based on the Tasks list template in SharePoint.
Then connected the list to Outlook.
I’ve started Fiddler and found that the Lists web service is used for synchronization. First, the GetList method is called.
Next, a GetListItemChangesSinceToken request is sent. This method is suggested by Microsoft for item synchronization. As one can read on MSDN:
“The most efficient way to synchronize third-party clients with Microsoft SharePoint Foundation 2010 is to download only those items that have changed since the last synchronization occurred. You can do this in SharePoint Foundation 2010 by calling the GetListItemChangesSinceToken Web method.”
The first request contains no token, and the response includes the entire list schema (not shown below). Since our task list contains no item, the ItemCount is zero.
Note, that the request above contains the Categories property, however, our Task content type has no such field.
I’ve created a new task item in the list to see how it is downloaded to Outlook.
Again, the GetListItemChangesSinceToken method was called, in this case there was a token in the request (changeToken is not shown below due to lack of space) and the value of ItemCount was 1 in response.
After synchronization, the item appeared in Outlook:
I’ve modified the task description, and found that on the next synchronization the UpdateListItems method was called to upload changes to SharePoint.
Before and after calling the UpdateListItems method the GetListItemChangesSinceToken method was called to detect possible conflicts and synchronize back changes from server.
To provide the Categories field for our tasks, I’ve added the existing site column with the same name to the list.
Set a test value for the field at the existing task,
and created a new one with other test values. Note, that I’ve specified two values in this case, separated by a comma.
As expected the values are synchronized down to Outlook, as shown in this view, grouped by the Categories field.
When opening Task 2, we found that our category values are not in the Master Category List.
We can resolve it – and add some color codes as well – by clicking New… on the dialog box.
After this configuration, Outlook handles our categories as known ones. Next, I’ve set a new category for the task in Outlook.
The Outlook view reflects the changes.
The UpdateListItems method uploads the changes to SharePoint.
And the updated values are displayed in our SharePoint list as well.
I hope this quick guide helps you to better understand the default synchronization process, and to utilize similar techniques in your applications.