public void Bind(MailboxSyncWatermark syncWatermark, int numOperations, Dictionary <ISyncItemId, ServerManifestEntry> serverManifest) { this.syncWatermark = syncWatermark; this.numOperations = numOperations; this.serverManifest = serverManifest; this.moreAvailable = false; this.lastServerManifestEntry = null; }
public virtual object Clone() { MailboxSyncWatermark mailboxSyncWatermark = MailboxSyncWatermark.CreateWithChangeNumber(this.ChangeNumber); if (this.icsState != null) { mailboxSyncWatermark.IcsState = (byte[])this.icsState.Clone(); } return(mailboxSyncWatermark); }
public override bool Equals(object thatObject) { if (thatObject == null) { return(false); } MailboxSyncWatermark mailboxSyncWatermark = thatObject as MailboxSyncWatermark; return(mailboxSyncWatermark != null && this.ChangeNumber == mailboxSyncWatermark.ChangeNumber); }
public int CompareTo(object thatObject) { MailboxSyncWatermark mailboxSyncWatermark = (MailboxSyncWatermark)thatObject; int rawChangeNumber = this.RawChangeNumber; int rawChangeNumber2 = mailboxSyncWatermark.RawChangeNumber; if (rawChangeNumber < rawChangeNumber2) { return(-1); } if (rawChangeNumber > rawChangeNumber2) { return(1); } return(0); }
private bool EnsureMapiManifest(MailboxSyncWatermark minWatermark, int numOperations, Dictionary <ISyncItemId, ServerManifestEntry> newServerManifest) { MemoryStream memoryStream = null; MapiFolder mapiFolder = this.folder.MapiFolder; if (this.manifest != null) { if (MailboxSyncProvider.IcsStateEquals(this.icsState, minWatermark.IcsState)) { if (this.extraServerManifestEntry != null) { if (numOperations == 0) { return(true); } newServerManifest.Add(this.extraServerManifestEntry.Id, this.extraServerManifestEntry); if (this.extraServerManifestEntry.Watermark != null) { minWatermark.ChangeNumber = ((MailboxSyncWatermark)this.extraServerManifestEntry.Watermark).ChangeNumber; } this.SyncLogger.Information <ISyncItemId>(ExTraceGlobals.SyncProcessTracer, (long)this.GetHashCode(), "MailboxSyncProvider::EnsureMapiManifest Adding cached change, id = {0}", this.extraServerManifestEntry.Id); this.extraServerManifestEntry = null; } this.icsCallback.Bind(minWatermark, numOperations, newServerManifest); this.SyncLogger.Information <int, int>(ExTraceGlobals.SyncProcessTracer, (long)this.GetHashCode(), "MailboxSyncProvider::EnsureMapiManifest Reusing ICS manifest, numOperations = {0}, newServerManifest.Count = {1}", numOperations, newServerManifest.Count); return(false); } this.manifest.Dispose(); this.manifest = null; this.SyncLogger.Information <int, int>(ExTraceGlobals.SyncProcessTracer, (long)this.GetHashCode(), "MailboxSyncProvider::EnsureMapiManifest Tossed old ICS manifest, numOperations = {0}, newServerManifest.Count = {1}", numOperations, newServerManifest.Count); } try { memoryStream = ((minWatermark.IcsState == null) ? new MemoryStream() : new MemoryStream(minWatermark.IcsState)); this.manifest = mapiFolder.CreateExportManifest(); this.icsCallback = new IcsCallback(this, newServerManifest, numOperations, minWatermark); Restriction restriction = (this.icsPropertyGroupFilter == null) ? null : FilterRestrictionConverter.CreateRestriction(this.folder.Session, this.folder.Session.ExTimeZone, this.folder.MapiFolder, this.icsPropertyGroupFilter); this.manifest.Configure(this.GetConfigFlags(), restriction, memoryStream, this.icsCallback, IcsCallback.PropTags); this.SyncLogger.Information <int, int>(ExTraceGlobals.SyncProcessTracer, (long)this.GetHashCode(), "MailboxSyncProvider::EnsureMapiManifest Created new ICS manifest, numOperations = {0}, newServerManifest.Count = {1}", numOperations, newServerManifest.Count); } finally { Util.DisposeIfPresent(memoryStream); } return(false); }
public ISyncWatermark GetMaxItemWatermark(ISyncWatermark currentWatermark) { this.CheckDisposed("GetMaxItemWatermark"); MailboxSyncWatermark mailboxSyncWatermark = MailboxSyncWatermark.Create(); mailboxSyncWatermark.IcsState = this.CatchUpIcsState((MailboxSyncWatermark)currentWatermark); using (QueryResult queryResult = this.folder.ItemQuery(ItemQueryType.None, null, MailboxSyncProvider.sortByArticleIdDescending, MailboxSyncProvider.queryColumns)) { object[][] rows = queryResult.GetRows(1); if (rows.Length != 0) { StoreObjectId objectId = ((VersionedId)rows[0][1]).ObjectId; mailboxSyncWatermark.ChangeNumber = (int)rows[0][0]; } } return(mailboxSyncWatermark); }
public virtual bool GetNewOperations(ISyncWatermark minSyncWatermark, ISyncWatermark maxSyncWatermark, bool enumerateDeletes, int numOperations, QueryFilter filter, Dictionary <ISyncItemId, ServerManifestEntry> newServerManifest) { if (numOperations < 0 && numOperations != -1) { throw new ArgumentException("numOperations is not valid, value = " + numOperations); } this.CheckDisposed("GetNewOperations"); MailboxSyncWatermark minWatermark = minSyncWatermark as MailboxSyncWatermark; MailboxSyncWatermark maxWatermark = maxSyncWatermark as MailboxSyncWatermark; if (filter != null) { this.SyncLogger.Information <int>(ExTraceGlobals.SyncProcessTracer, (long)this.GetHashCode(), "MailboxSyncProvider.GetNewOperations. numOperations = {0} With filter", numOperations); return(this.GetNewOperationsWithFilter(minWatermark, maxWatermark, numOperations, filter, newServerManifest)); } this.SyncLogger.Information <int>(ExTraceGlobals.SyncProcessTracer, (long)this.GetHashCode(), "MailboxSyncProvider.GetNewOperations. numOperations = {0} with ICS", numOperations); return(this.IcsGetNewOperations(minWatermark, enumerateDeletes, numOperations, newServerManifest)); }
private bool IcsGetNewOperations(MailboxSyncWatermark minWatermark, bool enumerateDeletes, int numOperations, Dictionary <ISyncItemId, ServerManifestEntry> newServerManifest) { this.SyncLogger.Information <int, int>(ExTraceGlobals.SyncProcessTracer, (long)this.GetHashCode(), "MailboxSyncProvider.IcsGetNewOperations. NumOperations {0}, newServerManifest.Count {1}", numOperations, newServerManifest.Count); bool flag = false; MemoryStream memoryStream = null; try { StoreSession session = this.folder.Session; bool flag2 = false; try { if (session != null) { session.BeginMapiCall(); session.BeginServerHealthCall(); flag2 = true; } if (StorageGlobals.MapiTestHookBeforeCall != null) { StorageGlobals.MapiTestHookBeforeCall(MethodBase.GetCurrentMethod()); } try { flag = this.EnsureMapiManifest(minWatermark, numOperations, newServerManifest); if (flag) { this.SyncLogger.Information(ExTraceGlobals.SyncProcessTracer, (long)this.GetHashCode(), "MailboxSyncProvider.IcsGetNewOperations. EnsureMapiManifest returned true (moreAvailable). Bailing out."); return(flag); } memoryStream = new MemoryStream(); ManifestStatus manifestStatus = ManifestStatus.Yielded; while (manifestStatus == ManifestStatus.Yielded) { manifestStatus = this.manifest.Synchronize(); switch (manifestStatus) { case ManifestStatus.Done: case ManifestStatus.Yielded: this.manifest.GetState(memoryStream); minWatermark.IcsState = memoryStream.ToArray(); this.icsState = minWatermark.IcsState; break; case ManifestStatus.Stopped: this.extraServerManifestEntry = this.icsCallback.ExtraServerManiferEntry; this.SyncLogger.Information <string>(ExTraceGlobals.SyncProcessTracer, (long)this.GetHashCode(), "MailboxSyncProvider::IcsGetNewOperations Got additional change, id = {0}", (this.extraServerManifestEntry == null) ? "NULL" : this.extraServerManifestEntry.Id.ToString()); break; } } flag = this.icsCallback.MoreAvailable; this.SyncLogger.Information <bool>(ExTraceGlobals.SyncProcessTracer, (long)this.GetHashCode(), "MailboxSyncProvider.IcsGetNewOperations. More available after ICS sync? {0}", flag); } catch (MapiExceptionCorruptData innerException) { throw new CorruptSyncStateException(ServerStrings.ExSyncStateCorrupted("ICS"), innerException); } catch (CorruptDataException innerException2) { throw new CorruptSyncStateException(ServerStrings.ExSyncStateCorrupted("ICS"), innerException2); } } catch (MapiPermanentException ex) { throw StorageGlobals.TranslateMapiException(ServerStrings.ICSSynchronizationFailed, ex, session, this, "{0}. MapiException = {1}.", new object[] { string.Format("MailboxSyncProvider::IcsGetNewOperations()", new object[0]), ex }); } catch (MapiRetryableException ex2) { throw StorageGlobals.TranslateMapiException(ServerStrings.ICSSynchronizationFailed, ex2, session, this, "{0}. MapiException = {1}.", new object[] { string.Format("MailboxSyncProvider::IcsGetNewOperations()", new object[0]), ex2 }); } finally { try { if (session != null) { session.EndMapiCall(); if (flag2) { session.EndServerHealthCall(); } } } finally { if (StorageGlobals.MapiTestHookAfterCall != null) { StorageGlobals.MapiTestHookAfterCall(MethodBase.GetCurrentMethod()); } } } } finally { Util.DisposeIfPresent(memoryStream); } return(flag); }
private bool GetNewOperationsWithFilter(MailboxSyncWatermark minWatermark, MailboxSyncWatermark maxWatermark, int numOperations, QueryFilter filter, Dictionary <ISyncItemId, ServerManifestEntry> newServerManifest) { this.SyncLogger.Information(ExTraceGlobals.SyncProcessTracer, (long)this.GetHashCode(), "MailboxSyncProvider.GetNewOperationsWithFilter. numOperations {0}, newServerManifest count {1}, minWatermark is New? {2}. Starting change number {3}", new object[] { numOperations, newServerManifest.Count, minWatermark.IsNew, minWatermark.ChangeNumber }); bool result = false; ComparisonFilter comparisonFilter = null; if (!minWatermark.IsNew) { comparisonFilter = new ComparisonFilter(ComparisonOperator.GreaterThan, InternalSchema.ArticleId, minWatermark.RawChangeNumber); } if (this.syncQueryResult == null) { this.syncQueryResult = MailboxSyncQueryProcessor.ItemQuery(this.folder, ItemQueryType.None, filter, this.itemQueryOptimizationFilter, MailboxSyncProvider.sortByArticleIdAscending, MailboxSyncProvider.queryColumns, this.allowTableRestrict, this.UseSortOrder); } else if (comparisonFilter == null) { this.syncQueryResult.SeekToOffset(SeekReference.OriginBeginning, 0); } if (comparisonFilter != null) { this.syncQueryResult.SeekToCondition(SeekReference.OriginBeginning, comparisonFilter); } bool flag = false; while (!flag) { int num; if (numOperations == -1) { num = 10000; } else { int num2 = numOperations - newServerManifest.Count; num = num2 + 1; } if (num < 0) { throw new InvalidOperationException(ServerStrings.ExNumberOfRowsToFetchInvalid(num.ToString())); } object[][] rows = this.syncQueryResult.GetRows(num); flag = (this.syncQueryResult.CurrentRow == this.syncQueryResult.EstimatedRowCount); this.SyncLogger.Information <int, int, bool>(ExTraceGlobals.SyncProcessTracer, (long)this.GetHashCode(), "MailboxSyncProvider.GetNewOperationsWithFilter. Requested {0} rows, Received {1} rows, All fetched? {2}", num, rows.Length, flag); for (int i = 0; i < rows.Length; i++) { try { StoreObjectId objectId = ((VersionedId)rows[i][1]).ObjectId; int changeNumber = (int)rows[i][0]; MailboxSyncWatermark mailboxSyncWatermark = (MailboxSyncWatermark)this.CreateNewWatermark(); mailboxSyncWatermark.UpdateWithChangeNumber(changeNumber, (bool)rows[i][2]); if (maxWatermark == null || maxWatermark.CompareTo(mailboxSyncWatermark) >= 0) { ISyncItemId syncItemId = this.CreateISyncItemIdForNewItem(objectId); ServerManifestEntry serverManifestEntry = this.CreateItemChangeManifestEntry(syncItemId, mailboxSyncWatermark); serverManifestEntry.ConversationId = (rows[i][3] as ConversationId); byte[] bytes = rows[i][4] as byte[]; ConversationIndex index; if (ConversationIndex.TryCreate(bytes, out index) && index != ConversationIndex.Empty && index.Components != null && index.Components.Count == 1) { serverManifestEntry.FirstMessageInConversation = true; } if (rows[i][5] is ExDateTime) { serverManifestEntry.FilterDate = new ExDateTime?((ExDateTime)rows[i][5]); } serverManifestEntry.MessageClass = (rows[i][6] as string); if (numOperations != -1 && newServerManifest.Count >= numOperations) { result = true; goto IL_2B9; } newServerManifest[serverManifestEntry.Id] = serverManifestEntry; minWatermark.ChangeNumber = changeNumber; } } catch { throw; } } } IL_2B9: this.SyncLogger.Information <int>(ExTraceGlobals.SyncProcessTracer, (long)this.GetHashCode(), "MailboxSyncProvider.GetNewOperationsWithFilter. Ending change number {0}", minWatermark.ChangeNumber); return(result); }
private byte[] CatchUpIcsState(MailboxSyncWatermark currentWatermark) { byte[] result = null; MapiFolder mapiFolder = this.folder.MapiFolder; MemoryStream memoryStream = null; MemoryStream memoryStream2 = null; try { if (currentWatermark.IcsState == null) { memoryStream = new MemoryStream(); } else { memoryStream = new MemoryStream(currentWatermark.IcsState); } StoreSession session = this.folder.Session; bool flag = false; try { if (session != null) { session.BeginMapiCall(); session.BeginServerHealthCall(); flag = true; } if (StorageGlobals.MapiTestHookBeforeCall != null) { StorageGlobals.MapiTestHookBeforeCall(MethodBase.GetCurrentMethod()); } try { using (MapiManifest mapiManifest = mapiFolder.CreateExportManifest()) { IcsCallback iMapiManifestCallback = new IcsCallback(this, null, 0, null); mapiManifest.Configure(this.GetConfigFlags() | ManifestConfigFlags.Catchup, null, memoryStream, iMapiManifestCallback, IcsCallback.PropTags); mapiManifest.Synchronize(); memoryStream2 = new MemoryStream(); mapiManifest.GetState(memoryStream2); result = memoryStream2.ToArray(); } } catch (MapiExceptionCorruptData innerException) { throw new CorruptSyncStateException(ServerStrings.ExSyncStateCorrupted("ICS"), innerException); } catch (CorruptDataException innerException2) { throw new CorruptSyncStateException(ServerStrings.ExSyncStateCorrupted("ICS"), innerException2); } } catch (MapiPermanentException ex) { throw StorageGlobals.TranslateMapiException(ServerStrings.ICSSynchronizationFailed, ex, session, this, "{0}. MapiException = {1}.", new object[] { string.Format("MailboxSyncProvider::CatchUpIcsState()", new object[0]), ex }); } catch (MapiRetryableException ex2) { throw StorageGlobals.TranslateMapiException(ServerStrings.ICSSynchronizationFailed, ex2, session, this, "{0}. MapiException = {1}.", new object[] { string.Format("MailboxSyncProvider::CatchUpIcsState()", new object[0]), ex2 }); } finally { try { if (session != null) { session.EndMapiCall(); if (flag) { session.EndServerHealthCall(); } } } finally { if (StorageGlobals.MapiTestHookAfterCall != null) { StorageGlobals.MapiTestHookAfterCall(MethodBase.GetCurrentMethod()); } } } } finally { Util.DisposeIfPresent(memoryStream); Util.DisposeIfPresent(memoryStream2); } return(result); }
public virtual ISyncWatermark CreateNewWatermark() { this.CheckDisposed("CreateNewWatermark"); return(MailboxSyncWatermark.Create()); }
public virtual object CustomClone() { return(MailboxSyncWatermark.CreateWithChangeNumber(this.ChangeNumber)); }
public ManifestCallbackStatus Change(byte[] entryId, byte[] sourceKey, byte[] changeKey, byte[] changeList, DateTime lastModifiedTime, ManifestChangeType changeType, bool associated, PropValue[] properties) { EnumValidator.ThrowIfInvalid <ManifestChangeType>(changeType, "changeType"); if (ExTraceGlobals.SyncTracer.IsTraceEnabled(TraceType.InfoTrace)) { this.TraceChangeChangeCallbackProps(entryId, sourceKey, changeKey, changeList, lastModifiedTime, changeType, associated, properties); } int? num = null; string text = null; bool read = false; ConversationId conversationId = null; bool firstMessageInConversation = false; ExDateTime? filterDate = null; foreach (PropValue propValue in properties) { if (!propValue.IsError()) { PropTag propTag = propValue.PropTag; if (propTag <= PropTag.MessageDeliveryTime) { if (propTag != PropTag.MessageClass) { ConversationIndex index; if (propTag != PropTag.ConversationIndex) { if (propTag == PropTag.MessageDeliveryTime) { if (propValue.PropType == PropType.SysTime) { filterDate = new ExDateTime?((ExDateTime)propValue.GetDateTime()); } } } else if (propValue.PropType == PropType.Binary && ConversationIndex.TryCreate(propValue.GetBytes(), out index) && index != ConversationIndex.Empty && index.Components != null && index.Components.Count == 1) { firstMessageInConversation = true; } } else if (propValue.PropType == PropType.String) { text = propValue.GetString(); } } else if (propTag != PropTag.MessageFlags) { if (propTag != PropTag.InternetArticleNumber) { if (propTag == PropTag.ConversationId) { if (propValue.PropType == PropType.Binary) { conversationId = ConversationId.Create(propValue.GetBytes()); } } } else { if (propValue.PropType != PropType.Int) { return(ManifestCallbackStatus.Continue); } num = new int?(propValue.GetInt()); } } else if (propValue.PropType == PropType.Int) { MessageFlags @int = (MessageFlags)propValue.GetInt(); read = ((@int & MessageFlags.IsRead) == MessageFlags.IsRead); } } } if (changeType == ManifestChangeType.Add || changeType == ManifestChangeType.Change) { if (num == null) { return(ManifestCallbackStatus.Continue); } StoreObjectId id = StoreObjectId.FromProviderSpecificId(entryId, (text == null) ? StoreObjectType.Unknown : ObjectClass.GetObjectType(text)); MailboxSyncItemId mailboxSyncItemId = MailboxSyncItemId.CreateForNewItem(id); MailboxSyncWatermark mailboxSyncWatermark = MailboxSyncWatermark.CreateForSingleItem(); mailboxSyncWatermark.UpdateWithChangeNumber(num.Value, read); ServerManifestEntry serverManifestEntry = this.mailboxSyncProvider.CreateItemChangeManifestEntry(mailboxSyncItemId, mailboxSyncWatermark); serverManifestEntry.IsNew = (changeType == ManifestChangeType.Add); serverManifestEntry.MessageClass = text; serverManifestEntry.ConversationId = conversationId; serverManifestEntry.FirstMessageInConversation = firstMessageInConversation; serverManifestEntry.FilterDate = filterDate; mailboxSyncItemId.ChangeKey = changeKey; this.lastServerManifestEntry = serverManifestEntry; } else { StoreObjectId id2 = StoreObjectId.FromProviderSpecificId(entryId, StoreObjectType.Unknown); MailboxSyncItemId mailboxSyncItemId2 = MailboxSyncItemId.CreateForExistingItem(this.mailboxSyncProvider.FolderSync, id2); if (mailboxSyncItemId2 == null) { return(ManifestCallbackStatus.Continue); } this.lastServerManifestEntry = MailboxSyncProvider.CreateItemDeleteManifestEntry(mailboxSyncItemId2); this.lastServerManifestEntry.ConversationId = conversationId; } return(this.CheckYieldOrStop()); }
internal IcsCallback(MailboxSyncProvider mailboxSyncProvider, Dictionary <ISyncItemId, ServerManifestEntry> serverManifest, int numOperations, MailboxSyncWatermark syncWatermark) { this.mailboxSyncProvider = mailboxSyncProvider; this.serverManifest = serverManifest; this.numOperations = numOperations; this.moreAvailable = false; this.syncWatermark = syncWatermark; this.lastServerManifestEntry = null; }
private Dictionary <StoreObjectId, string> ProcessCommand(Dictionary <string, CommonNode> oldItems, Folder sourceFolder, MailboxSession mailboxSession) { if (oldItems == null) { throw new ArgumentNullException("items"); } Dictionary <StoreObjectId, string> dictionary = new Dictionary <StoreObjectId, string>(); if (oldItems.Count == 0) { return(dictionary); } GenericDictionaryData <DerivedData <ISyncItemId>, ISyncItemId, ClientManifestEntry> genericDictionaryData = (GenericDictionaryData <DerivedData <ISyncItemId>, ISyncItemId, ClientManifestEntry>) this.syncState[SyncStateProp.CumulativeClientManifest]; if (genericDictionaryData != null) { return(null); } genericDictionaryData = new GenericDictionaryData <DerivedData <ISyncItemId>, ISyncItemId, ClientManifestEntry>(); this.syncState[SyncStateProp.CumulativeClientManifest] = genericDictionaryData; this.clientManifest = genericDictionaryData.Data; this.clientManifest = new Dictionary <ISyncItemId, ClientManifestEntry>(); genericDictionaryData.Data = this.clientManifest; GenericDictionaryData <DerivedData <ISyncItemId>, ISyncItemId, FolderSync.ClientStateInformation> genericDictionaryData2 = (GenericDictionaryData <DerivedData <ISyncItemId>, ISyncItemId, FolderSync.ClientStateInformation>) this.syncState[SyncStateProp.ClientState]; if (genericDictionaryData2 != null) { return(null); } genericDictionaryData2 = new GenericDictionaryData <DerivedData <ISyncItemId>, ISyncItemId, FolderSync.ClientStateInformation>(); this.syncState[SyncStateProp.ClientState] = genericDictionaryData2; genericDictionaryData2.Data = new Dictionary <ISyncItemId, FolderSync.ClientStateInformation>(); MailboxSyncProviderFactory mailboxSyncProviderFactory = new MailboxSyncProviderFactory(mailboxSession, sourceFolder.StoreObjectId); ISyncProvider syncProvider = mailboxSyncProviderFactory.CreateSyncProvider(null); FolderSync folderSync = new FolderSync(syncProvider, this.syncState, ConflictResolutionPolicy.ServerWins, false); using (QueryResult queryResult = sourceFolder.ItemQuery(ItemQueryType.None, null, null, ItemSyncUpgrade.queryColumns)) { bool flag = false; while (!flag && oldItems.Count > 0) { object[][] rows = queryResult.GetRows(10000); flag = (rows.Length == 0); int num = 0; while (num < rows.Length && oldItems.Count > 0) { if (!(rows[num][0] is VersionedId) || !(rows[num][1] is int) || !(rows[num][2] is bool)) { throw new ApplicationException("The data returned from the query is unusable!"); } VersionedId versionedId = (VersionedId)rows[num][0]; StoreObjectId objectId = versionedId.ObjectId; int changeNumber = (int)rows[num][1]; string messageClass = rows[num][3] as string; string oldIdFromNewId = ItemSyncUpgrade.GetOldIdFromNewId(objectId.ProviderLevelItemId); if (oldIdFromNewId == null) { throw new ApplicationException("The new Id is invalid!"); } if (oldItems.ContainsKey(oldIdFromNewId)) { CommonNode commonNode = oldItems[oldIdFromNewId]; oldItems.Remove(oldIdFromNewId); dictionary.Add(objectId, commonNode.ServerId); ISyncItemId syncItemId = MailboxSyncItemId.CreateForNewItem(objectId); FolderSync.ClientStateInformation clientStateInformation = new FolderSync.ClientStateInformation(); clientStateInformation.ClientHasItem = true; genericDictionaryData2.Data[syncItemId] = clientStateInformation; if (!ItemSyncUpgrade.HasChanged(commonNode.VersionId, versionedId)) { bool read; if (commonNode.IsEmail && commonNode.Read != (bool)rows[num][2]) { folderSync.QueueDelayedServerOperation(new ServerManifestEntry(syncItemId) { ChangeType = ChangeType.ReadFlagChange }); read = commonNode.Read; } else { read = (bool)rows[num][2]; } ClientManifestEntry clientManifestEntry = new ClientManifestEntry(syncItemId); clientManifestEntry.Watermark = MailboxSyncWatermark.CreateForSingleItem(); clientManifestEntry.ClientAddId = "TiSyncStateUpgrade"; clientManifestEntry.ChangeType = ChangeType.Add; clientManifestEntry.MessageClass = messageClass; ((MailboxSyncWatermark)clientManifestEntry.Watermark).UpdateWithChangeNumber(changeNumber, read); this.clientManifest.Add(syncItemId, clientManifestEntry); } else { folderSync.QueueDelayedServerOperation(new ServerManifestEntry(syncItemId) { ChangeType = ChangeType.Change, MessageClass = messageClass }); } } num++; } } } if (oldItems.Count > 0) { foreach (KeyValuePair <string, CommonNode> keyValuePair in oldItems) { string key = keyValuePair.Key; CommonNode value = keyValuePair.Value; byte[] bytes = Encoding.Unicode.GetBytes(value.ServerId); StoreObjectId storeObjectId = StoreObjectId.FromProviderSpecificId(bytes, StoreObjectType.Mailbox); dictionary.Add(storeObjectId, value.ServerId); MailboxSyncItemId mailboxSyncItemId = MailboxSyncItemId.CreateForNewItem(storeObjectId); folderSync.QueueDelayedServerOperation(new ServerManifestEntry(mailboxSyncItemId) { ChangeType = ChangeType.Delete }); FolderSync.ClientStateInformation clientStateInformation2 = new FolderSync.ClientStateInformation(); clientStateInformation2.ClientHasItem = true; genericDictionaryData2.Data[mailboxSyncItemId] = clientStateInformation2; } } return(dictionary); }