Example #1
0
        static void CleanUpProvider(KnowledgeSyncProvider provider)
        {
            AppointmentSyncProvider   outlookProvider = provider as AppointmentSyncProvider;
            CalendarEventSyncProvider ibnProvider     = provider as CalendarEventSyncProvider;

            if (outlookProvider != null)
            {
                // Remove the data store file
                string metafile = outlookProvider.CurrentSetting.CurrentSyncAppSetting.metaDataFileName;
                if (System.IO.File.Exists(metafile))
                {
                    System.IO.File.Delete(metafile);
                }
            }
            else if (ibnProvider != null)
            {
                FilterElement filterEl = new FilterElement(SynchronizationMetadataRow.ColumnReplicaId, FilterElementType.Equal, ibnProvider.ReplicaId.GetGuidId());
                foreach (SynchronizationMetadataRow row in SynchronizationMetadataRow.List(filterEl))
                {
                    BusinessManager.Delete(new CalendarEventEntity((PrimaryKeyId)row.Uri));

                    row.Delete();
                }
                SynchronizationReplicaRow.Delete(ibnProvider.ReplicaId.GetGuidId());
            }
        }
Example #2
0
        public static IEnumerable <ItemMetadataAdaptor> GetAllMetadataItems(SyncId replicaId)
        {
            FilterElement filterEl = new FilterElement(SynchronizationMetadataRow.ColumnReplicaId, FilterElementType.Equal,
                                                       replicaId.GetGuidId());

            return(SynchronizationMetadataRow.List(filterEl).Select(x => new ItemMetadataAdaptor(x)));
        }
Example #3
0
        public static IEnumerable <ItemMetadata> FindMetadataItemByCustomField(string customField, object value)
        {
            Type valueType = value.GetType();

            FilterElement filterEl = new FilterElement(customField, FilterElementType.Equal, value);

            foreach (SynchronizationMetadataRow itemRow in SynchronizationMetadataRow.List(filterEl))
            {
                yield return(new ItemMetadataAdaptor(itemRow));
            }
        }
Example #4
0
        public static ItemMetadataAdaptor FindMetadataItemById(SyncId replicaId, SyncId globalId)
        {
            ItemMetadataAdaptor retVal   = null;
            FilterElement       filterEl = new AndBlockFilterElement();

            filterEl.ChildElements.Add(new FilterElement(SynchronizationMetadataRow.ColumnReplicaId, FilterElementType.Equal,
                                                         replicaId.GetGuidId()));
            filterEl.ChildElements.Add(new FilterElement(SynchronizationMetadataRow.ColumnUniqueId, FilterElementType.Equal,
                                                         globalId.GetSyncGlobalId().UniqueId));
            filterEl.ChildElements.Add(new FilterElement(SynchronizationMetadataRow.ColumnPrefix, FilterElementType.Equal,
                                                         (long)globalId.GetSyncGlobalId().Prefix));

            SynchronizationMetadataRow[] itemRows = SynchronizationMetadataRow.List(filterEl);
            if (itemRows.Length != 0)
            {
                retVal = new ItemMetadataAdaptor(itemRows[0]);
            }

            return(retVal);
        }