internal static SyncRequest CreateSyncRequestForAllMessages(string syncKey, string serverId, int windowSize, bool recentOnly) { SyncFilterType filter = recentOnly ? SyncFilterType.ThreeDaysBack : SyncFilterType.NoFilter; Microsoft.Exchange.Connections.Eas.Model.Request.AirSync.Collection item = EasRequestGenerator.CollectionForSyncMetadata(syncKey, serverId, windowSize, filter); return(new SyncRequest { Collections = { item } }); }
private static Microsoft.Exchange.Connections.Eas.Model.Request.AirSync.Collection CollectionForSyncMetadata(string syncKey, string serverId, int windowSize, SyncFilterType filter) { Microsoft.Exchange.Connections.Eas.Model.Request.AirSync.Collection collection = new Microsoft.Exchange.Connections.Eas.Model.Request.AirSync.Collection { SyncKey = syncKey, CollectionId = serverId, DeletesAsMoves = new bool?(false), WindowSize = new int?(Math.Max(0, Math.Min(windowSize, 512))) }; Microsoft.Exchange.Connections.Eas.Model.Request.AirSync.Options item = new Microsoft.Exchange.Connections.Eas.Model.Request.AirSync.Options { FilterType = new byte?((byte)filter) }; collection.Options.Add(item); return(collection); }
internal static SyncRequest CreateSyncRequestForSelectedMessages(IReadOnlyCollection <string> messageIds, string syncKey, string serverId) { SyncRequest syncRequest = new SyncRequest(); Microsoft.Exchange.Connections.Eas.Model.Request.AirSync.Collection collection = new Microsoft.Exchange.Connections.Eas.Model.Request.AirSync.Collection { SyncKey = syncKey, CollectionId = serverId, GetChanges = new bool?(false) }; foreach (string messageId in messageIds) { Command item = EasRequestGenerator.CommandForFetchSingle(messageId); collection.Commands.Add(item); } syncRequest.Collections.Add(collection); return(syncRequest); }
internal static SyncRequest CreateSyncRequestForUpdateCalendarEvent(string syncKey, string itemId, string folderId, Event theEvent, IList <Event> exceptionalEvents, IList <string> deletedOccurrences, UserSmtpAddress userSmtpAddress) { Microsoft.Exchange.Connections.Eas.Model.Request.AirSync.Collection collection = new Microsoft.Exchange.Connections.Eas.Model.Request.AirSync.Collection(); ChangeCommand changeCommand = new ChangeCommand(); changeCommand.ServerId = itemId; changeCommand.ApplicationData = SyncCalendarUtils.ConvertEventToAppData(theEvent, exceptionalEvents, deletedOccurrences, userSmtpAddress); collection.Commands.Add(changeCommand); collection.SyncKey = syncKey; collection.CollectionId = folderId; collection.GetChanges = new bool?(false); return(new SyncRequest { Collections = { collection } }); }