internal Properties FetchCalendarItem(string itemId, string folderId)
        {
            ItemOperationsRequest  itemOperationsRequest  = EasRequestGenerator.CreateItemOpsRequestForCalendarItem(itemId, folderId);
            ItemOperationsResponse itemOperationsResponse = this.ItemOperations(itemOperationsRequest);

            return(itemOperationsResponse.GetCalendarItemProperties());
        }
        internal byte[] CreateCalendarEvent(string clientId, string syncKey, out string newSyncKey, string folderId, Event theEvent, IList <Event> exceptionalEvents, IList <string> deletedOccurrences, UserSmtpAddress userSmtpAddress)
        {
            SyncRequest  syncRequest  = EasRequestGenerator.CreateSyncRequestForCreateCalendarEvent(syncKey, clientId, folderId, theEvent, exceptionalEvents, deletedOccurrences, userSmtpAddress);
            SyncResponse syncResponse = this.SyncCreation(clientId, syncRequest);

            newSyncKey = syncResponse.Collections[0].SyncKey;
            return(EasMailbox.GetEntryId(syncResponse.AddResponses[0].ServerId));
        }
        internal void DeleteItem(string messageId, string syncKey, string folderId)
        {
            SyncRequest syncRequest = EasRequestGenerator.CreateSyncRequestForDeleteMessages(new string[]
            {
                messageId
            }, syncKey, folderId);

            this.Sync(syncRequest);
        }
        internal void SyncFlag(string messageId, string syncKey, string folderId, FlagStatus flagStatus)
        {
            SyncRequest syncRequest = EasRequestGenerator.CreateSyncRequestForFlagMessages(new string[]
            {
                messageId
            }, syncKey, folderId, flagStatus);

            this.SyncUpdate(messageId, syncRequest);
        }
        internal void SyncRead(string messageId, string syncKey, string folderId, bool isRead)
        {
            SyncRequest syncRequest = EasRequestGenerator.CreateSyncRequestForReadUnreadMessages(new string[]
            {
                messageId
            }, syncKey, folderId, isRead);

            this.SyncUpdate(messageId, syncRequest);
        }
        internal string MoveItem(string messageId, string sourceFolderId, string destinationFolderId)
        {
            MoveItemsRequest moveItemsRequest = EasRequestGenerator.CreateMoveRequestForMessages(new string[]
            {
                messageId
            }, sourceFolderId, destinationFolderId);
            MoveItemsResponse moveItemsResponse = this.MoveItems(moveItemsRequest);

            return(moveItemsResponse.Responses[0].DstMsgId);
        }
        internal int GetCountOfItemsToSync(string folderId, EasSyncOptions options)
        {
            GetItemEstimateRequest  getItemEstimateRequest = EasRequestGenerator.CreateEstimateRequest(options.SyncKey, folderId, options.RecentOnly);
            GetItemEstimateResponse itemEstimate           = this.GetItemEstimate(getItemEstimateRequest);

            if (itemEstimate.Estimate == null)
            {
                return(0);
            }
            return(itemEstimate.Estimate.Value);
        }
Пример #8
0
        internal static ItemOperationsRequest CreateItemOpsRequestForCalendarItem(string messageId, string folderId)
        {
            ItemOperationsRequest itemOperationsRequest = EasRequestGenerator.CreateItemOpsRequest(messageId, folderId);

            itemOperationsRequest.Fetches[0].Options.BodyPreference = new BodyPreference
            {
                Type           = new byte?(1),
                AllOrNone      = new bool?(true),
                TruncationSize = new uint?(10000U)
            };
            return(itemOperationsRequest);
        }
        internal Properties FetchMessageItem(string messageId, string folderId)
        {
            ItemOperationsRequest  itemOperationsRequest = EasRequestGenerator.CreateItemOpsRequest(messageId, folderId);
            ItemOperationsResponse response = this.ItemOperations(itemOperationsRequest);
            ItemOperationsStatus   status;
            Properties             messageProperties = response.GetMessageProperties(0, out status);

            EasConnectionWrapper.WrapException(delegate()
            {
                response.ThrowIfStatusIsFailed(status);
            }, (ConnectionsTransientException e) => new EasFetchFailedTransientException(e.Message, e), (ConnectionsPermanentException e) => new EasFetchFailedPermanentException(e.Message, e));
            return(messageProperties);
        }
Пример #10
0
        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);
        }
Пример #11
0
        internal ItemOperationsResponse LookupItems(IReadOnlyCollection <string> messageIds, string folderId)
        {
            ItemOperationsRequest itemOperationsRequest = EasRequestGenerator.CreateItemOpsRequestForSelectedMessages(messageIds, folderId);

            return(this.ItemOperations(itemOperationsRequest));
        }
Пример #12
0
        internal void UpdateCalendarEvent(string calendarEventId, string syncKey, string folderId, Event theEvent, IList <Event> exceptionalEvents, IList <string> deletedOccurrences, UserSmtpAddress userSmtpAddress)
        {
            SyncRequest syncRequest = EasRequestGenerator.CreateSyncRequestForUpdateCalendarEvent(syncKey, calendarEventId, folderId, theEvent, exceptionalEvents, deletedOccurrences, userSmtpAddress);

            this.SyncUpdate(calendarEventId, syncRequest);
        }
Пример #13
0
        internal SyncResponse Sync(string folderId, EasSyncOptions options, bool recentOnly)
        {
            SyncRequest syncRequest = EasRequestGenerator.CreateSyncRequestForAllMessages(options.SyncKey, folderId, options.MaxNumberOfMessage, recentOnly);

            return(this.Sync(syncRequest));
        }
Пример #14
0
        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
                }
            });
        }
Пример #15
0
        internal static GetItemEstimateRequest CreateEstimateRequest(string syncKey, string serverId, bool recentOnly)
        {
            SyncFilterType filter = recentOnly ? SyncFilterType.ThreeDaysBack : SyncFilterType.NoFilter;

            Microsoft.Exchange.Connections.Eas.Model.Request.GetItemEstimate.Collection item = EasRequestGenerator.CollectionForItemEstimate(syncKey, serverId, filter);
            return(new GetItemEstimateRequest
            {
                Collections =
                {
                    item
                }
            });
        }