locked
Custom sync : global item ids RRS feed

  • Question

  • I started to look at the sync framework, our requirements is to synchronize Exchange and our custom CRM application (Contacts, Appointments, Tasks...) in a server to server scenario.

    I am planning to develop 2 custom providers : one for Exchange, one for our custom database.

    I was wondering what is the best way to manage global ids for each item. For example, contacts or appointments use different unique ids on each side (a guid primary key in our custom CRM and a unique ID i can retrieve using webdav on Exchange).
    How can i map them when synchronizing ? Should i use my own 48 bytes uniqueid in both metadata store, and then map it differently to the right item in both data stores ?

    Any thoughts, best practice ?

    Thank you,
    Alexandre
    • Moved by Max Wang_1983 Thursday, April 21, 2011 10:11 PM forum consolidation (From:SyncFx - Technical Discussion [ReadOnly])
    Thursday, April 3, 2008 12:37 PM

Answers

  • The data items in different data store could have its own mechanism for the item identity (local id) and they could be different on different stores. But the global id is part of the metadata required by Sync framework and they need to be same format across the sync providers being synced.

     

    When writing a sync provider which syncs data in the data store, a important task is set up and store the right item metadata for all the items being synced. Some metadata are required by the Sync engine such as item global id, creation version and update version etc. Some other metadata may be defined for the specific provider. A separate metastore is normally needed to store all these metadata. There is a ready to use metadata store component in the sync framework.

     

     

     

    Friday, April 4, 2008 8:41 PM
    Answerer

All replies

  •  

    Hi,

     

    Even i have the similar requirement. To sync between a client data base (SQL CE) and a web method in a webservice exposed from other external systems. Any inputs is very much helpful.

     

    Thanks a lot,

    Rathi

     

    Thursday, April 3, 2008 12:50 PM
  •  

    I believe the Global Ids on both sync sides should have the exact same Id format and same value for same sync entity.

    but you could use a variable length id format so that different sync entities may use differen length of Ids.

     

     

    Friday, April 4, 2008 12:53 AM
    Answerer
  • The problem i see here is that items can be created either by the synchro providers, or from the applications using the data store (for example Exchange/Outlook).
    That means i can not have my own unique id, since i'm not the only one (in custom provider) to create items..I need to rely on the ones in each data store, but they are different.

    Maybe i am missing sth ?

    Friday, April 4, 2008 7:38 AM
  • The data items in different data store could have its own mechanism for the item identity (local id) and they could be different on different stores. But the global id is part of the metadata required by Sync framework and they need to be same format across the sync providers being synced.

     

    When writing a sync provider which syncs data in the data store, a important task is set up and store the right item metadata for all the items being synced. Some metadata are required by the Sync engine such as item global id, creation version and update version etc. Some other metadata may be defined for the specific provider. A separate metastore is normally needed to store all these metadata. There is a ready to use metadata store component in the sync framework.

     

     

     

    Friday, April 4, 2008 8:41 PM
    Answerer
  • That's much clearer now : one global unique id for each item in both metada store, and providers are responsible to map this global unique id to local data store unique id.

    Thank you for your answer Jin.

    Alexandre


    Sunday, April 6, 2008 7:46 PM
  • Hi,

     

    I am facing a similar problem when trying to sync tasks (webdav) and tasks (sql). How is the id mapping done? Do I have to enumerate all items on each side or how could this be solved?

     

    Any help appriciated!

     

    Best Regards

     

    Martin

    Wednesday, April 9, 2008 1:15 PM
  • Hi Martin,

    Here is the solution i am thinking to use:

    For each item, I will use a global sync ID. Any items in data stores that takes part in synchronization should have this global ID set. It will be different than the one used locally by each data store.

    It will be the responsability of custom providers to ensure that each item in their data store have a global sync ID set.

    When a provider enumerate items in its data store to create the metadata, there are 2 cases:
    - if an item is found without this global sync ID, it means the item was not yet synchronized. In that case, the provider creates a new global ID (a Guid for example), and updates the item in the data store. The metadata is then created with that new global ID as parameter.
    - if an item is found with a global sync ID already set, the corresponding metadata is created with the existing global sync ID.

    For providers having SQL database as data store, it should not be a problem, you can add a new column "globalsyncid" in the tables you are synchronizing.

    For a provider using Exchange as a datastore, you have the possibility to a add custom property to any Exchange item (Contact, Appointments, Tasks...). You can do that by issuing WebDav queries directly (http://weblogs.sqlteam.com/mladenp/articles/9560.aspx), or much better and simpler, use this great library: http://www.infinitec.de/libraries/exchange/default.aspx.

    I would love to hear any other solutions or suggestions if any.

    Alexandre
    Wednesday, April 9, 2008 3:51 PM
  •  

    Thank you Alexandre,

     

    Superb answer and now its all much clearer to me as well... Wink

     

    Martin

    Thursday, April 10, 2008 9:57 AM