MailKit.Net.Imap.ImapClient.EnableQuickResync C# (CSharp) Метод

EnableQuickResync() публичный Метод

Enable the QRESYNC feature.

Enables the QRESYNC feature.

The QRESYNC extension improves resynchronization performance of folders by querying the IMAP server for a list of changes when the folder is opened using the ImapFolder.Open(FolderAccess,uint,ulong,System.Collections.Generic.IList<UniqueId>,System.Threading.CancellationToken) method.

If this feature is enabled, the MailFolder.MessageExpunged event is replaced with the MailFolder.MessagesVanished event.

This method needs to be called immediately after calling one of the Authenticate methods, before opening any folders.

/// The has been disposed. /// /// The is not connected. /// /// The is not authenticated. /// /// Quick resynchronization needs to be enabled before selecting a folder. /// /// The IMAP server does not support the QRESYNC extension. /// /// The operation was canceled via the cancellation token. /// /// An I/O error occurred. /// /// The server replied to the ENABLE command with a NO or BAD response. /// /// An IMAP protocol error occurred. ///
public EnableQuickResync ( CancellationToken cancellationToken = default(CancellationToken) ) : void
cancellationToken System.Threading.CancellationToken The cancellation token.
Результат void
		public override void EnableQuickResync (CancellationToken cancellationToken = default (CancellationToken))
		{
			CheckDisposed ();
			CheckConnected ();
			CheckAuthenticated ();

			if (engine.State != ImapEngineState.Authenticated)
				throw new InvalidOperationException ("QRESYNC needs to be enabled immediately after authenticating.");

			if ((engine.Capabilities & ImapCapabilities.QuickResync) == 0)
				throw new NotSupportedException ("The IMAP server does not support the QRESYNC extension.");

			if (engine.QResyncEnabled)
				return;

			var ic = engine.QueueCommand (cancellationToken, null, "ENABLE QRESYNC CONDSTORE\r\n");

			engine.Wait (ic);

			ProcessResponseCodes (ic);

			if (ic.Response != ImapCommandResponse.Ok)
				throw ImapCommandException.Create ("ENABLE", ic);

			engine.QResyncEnabled = true;
		}