/// <summary>
        /// Synchronizes email messages.
        /// </summary>
        /// <param name="syncAction">Sync action for <see cref="Envelope"/> instance.</param>
        /// <param name="crmFolders">Specific directories to synchronize.</param>
        /// <param name="loadAll">Defines the need to download all messages.</param>
        public void SyncMailMessages(Func <MailMessage, Envelope, bool, string, bool> syncAction, Dictionary <string, List <Guid> > crmFolders, bool loadAll = true)
        {
            SynchronizationErrorHelper helper = SynchronizationErrorHelper.GetInstance(_userConnection);

            try {
                if (loadAll)
                {
                    _log.Info(string.Format("[{0}] | Loading emails from all folders", _currentMailboxName));
                    SyncAllFolders(syncAction, crmFolders);
                }
                else
                {
                    _log.Info(string.Format("[{0}] | Loading emails from selected folders", _currentMailboxName));
                    SyncSelectedFolders(syncAction, crmFolders);
                }
                helper.CleanUpSynchronizationError(_currentMailboxName);
            } catch (Exception ex) {
                helper.ProcessSynchronizationError(_currentMailboxName, ex);
                if (ex is MailBeeException)
                {
                    throw new ImapException(LocSyncError.ToString(), ex);
                }
                throw ex;
            }
        }
Example #2
0
 /// <summary>
 /// <see cref="RemoteProvider.CommitChanges"/>
 /// </summary>
 /// <remarks>
 /// Creates upload attachments schedule task.
 /// </remarks>
 public override void CommitChanges(SyncContext context)
 {
     if (context.UserConnection.GetIsFeatureEnabled("LoadAttachmentsInSameProcess"))
     {
         UploadAttachmentsData(context);
     }
     else
     {
         CreateUploadAttachmentJob(context);
     }
     UpdateLastSyncDate(context.UserConnection, context);
     SendSyncSessionFinished(context.UserConnection);
     _syncErrorHelper.CleanUpSynchronizationError(SenderEmailAddress);
     UnlockSyncedEntities(context.UserConnection);
 }
Example #3
0
 /// <summary>
 /// Updates last synchronization date value.
 /// </summary>
 /// <param name="context"><see cref="SyncContext"/> instance.</param>
 public override void CommitChanges(SyncContext context)
 {
     UpdateLastSyncDate(context.UserConnection, context);
     _syncErrorHelper.CleanUpSynchronizationError(SenderEmailAddress);
 }
Example #4
0
 /// <summary>
 /// Updates last synchtonization date.
 /// </summary>
 /// <param name="context">Synchronization context.</param>
 public override void CommitChanges(SyncContext context)
 {
     base.CommitChanges(context);
     _syncErrorHelper.CleanUpSynchronizationError(SenderEmailAddress);
 }