How to: Create an Unmanaged Synchronization Application

This topic shows how to use an unmanaged language, such as C++, to create an application that uses Microsoft Sync Framework to create a synchronization session and connect it to source and destination providers.

This topic assumes a basic familiarity with C++ and COM concepts.

The examples in this topic focus on the following Sync Framework components:

Understanding Synchronization Applications

A synchronization application is a software component that creates a synchronization session, connects it with two synchronization providers, uses the session to start synchronization, and hosts Sync Framework during synchronization.

For more information about the role of the synchronization application, see Implementing a Synchronization Application.

Build Requirements

  • Synchronization.h: declarations for Sync Framework components.

  • SynchronizationErrors.h: custom error codes.

  • Synchronization.lib: import library.

Example

The example code in this topic shows how to create a synchronization session, initialize it with source and destination providers, and start the session. The example also shows one way to display session statistics to the user.

Be aware that an application can obtain the providers in the way that is most appropriate for the kind of the application. The example assumes the application already has two ISyncProvider Interface interfaces: one that represents the source replica and the other that represents the destination replica.

Creating and Starting a Synchronization Session

The examples uses CoCreateInstance to create an IApplicationSyncServices object. This object is then used to create and initialize a session object. The session is started. When synchronization finishes, the session statistics are shown to the user in a message box.

Next Steps

Now that you have created a synchronization application, you might want to create a synchronization provider. For more information, see How to: Create an Unmanaged Synchronization Provider. You might also want to enhance the application by registering it to receive notifications during the session. For more information, see Responding to Synchronization Events.

関連項目

参照

ISyncSession Interface

SYNC_SESSION_STATISTICS Structure

概念

Implementing a Synchronization Application