none
Is there an easy way to tell when the last sync occurred? RRS feed

  • Question

  • I would like to let the users know the last time that they synced, is there a property that I can call to get this value?
    Travich
    Friday, April 30, 2010 8:42 PM

Answers

  • Sync metadata does not keep any temporal information if you were looking for the last time sync occurred.

    That is something that you could have your sync app persist outside of sync scope (files/tables etc that you are syncing) and use this persisted timestamp to let users know of last sync time. Do keep in mind to persist this time once sync is complete - not before invoking sync since sync may take time depending upon your data/env. (you have likely figured this as well).

    Hope this helps,

    Sameer

     

     

     

    • Marked as answer by travich Friday, April 30, 2010 9:07 PM
    Friday, April 30, 2010 9:04 PM

All replies

  • Sync metadata does not keep any temporal information if you were looking for the last time sync occurred.

    That is something that you could have your sync app persist outside of sync scope (files/tables etc that you are syncing) and use this persisted timestamp to let users know of last sync time. Do keep in mind to persist this time once sync is complete - not before invoking sync since sync may take time depending upon your data/env. (you have likely figured this as well).

    Hope this helps,

    Sameer

     

     

     

    • Marked as answer by travich Friday, April 30, 2010 9:07 PM
    Friday, April 30, 2010 9:04 PM
  • What I've done is to log the properties of SyncStatistics (http://msdn.microsoft.com/en-us/library/microsoft.synchronization.data.syncstatistics_members%28v=SQL.105%29.aspx) returned from SyncAgent->Synchronize() and you then have an excellent record of what happened when (the SyncStatistics class gives you the sync start time and sync complete tme as well as other useful metrics):

     

    SyncStatistics stats = syncAgent.Synchronize();
    LogSyncStatistics(stats);

     

    My LogSyncStatistics method simply inserts the values of SyncStatistics into a local database table where I can then nicely present them on a form for the end-user. (I keep the entire sync history of the local application). To answer your original question, you can also then select the row from this table containing the most recent sync complete time.

     

    Tuesday, May 4, 2010 5:50 PM
  • you may want to include this table as well in your sync. so you can track locally when the client last synced. and on the server, you can track when each client synched.

    a little more info like last sent and last received from each client and you can pretty much figure out from the server which client has yet to receive changes from the server :)

    Tuesday, May 4, 2010 10:55 PM
    Moderator