/// <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; } }
public bool ValidateCustomFlagsSupport() { try { _client.SelectFolder(_bpmOnlineFolderFullName); var strategy = new FlagBasedSyncStrategy(_userConnection); return(strategy.ValidateCustomFlagsSuport(_client)); } catch (MailBeeException e) { throw new ImapException(LocSyncError.ToString(), e); } }
/// <summary> /// Returns <see cref="FolderCollection"/> instance. /// </summary> /// <remarks> /// Draft folders will be filtered. /// </remarks> public FolderCollection TryGetFoldersCollection() { FolderCollection folders = null; try { folders = _client.DownloadFolders(false); } catch (MailBeeException e) { throw new ImapException(LocSyncError.ToString(), e); } int draftsIndex = GetIndexDraftsFolder(folders); if (draftsIndex > 0) { folders.RemoveAt(draftsIndex); } return(folders); }