A folder namespace.
A folder namespace.
Beispiel #1
0
        /// <summary>
        /// Asynchronously get all of the folders within the specified namespace.
        /// </summary>
        /// <remarks>
        /// Asynchronously gets all of the folders within the specified namespace.
        /// </remarks>
        /// <returns>The folders.</returns>
        /// <param name="namespace">The namespace.</param>
        /// <param name="items">The status items to pre-populate.</param>
        /// <param name="subscribedOnly">If set to <c>true</c>, only subscribed folders will be listed.</param>
        /// <param name="cancellationToken">The cancellation token.</param>
        /// <exception cref="System.ArgumentNullException">
        /// <paramref name="namespace"/> is <c>null</c>.
        /// </exception>
        /// <exception cref="System.ObjectDisposedException">
        /// The <see cref="MailStore"/> has been disposed.
        /// </exception>
        /// <exception cref="ServiceNotConnectedException">
        /// The <see cref="MailStore"/> is not connected.
        /// </exception>
        /// <exception cref="ServiceNotAuthenticatedException">
        /// The <see cref="MailStore"/> is not authenticated.
        /// </exception>
        /// <exception cref="System.OperationCanceledException">
        /// The operation was canceled via the cancellation token.
        /// </exception>
        /// <exception cref="System.IO.IOException">
        /// An I/O error occurred.
        /// </exception>
        /// <exception cref="ProtocolException">
        /// A protocol error occurred.
        /// </exception>
        /// <exception cref="CommandException">
        /// The command failed.
        /// </exception>
        public virtual Task <IEnumerable <IMailFolder> > GetFoldersAsync(FolderNamespace @namespace, StatusItems items = StatusItems.None, bool subscribedOnly = false, CancellationToken cancellationToken = default(CancellationToken))
        {
            if (@namespace == null)
            {
                throw new ArgumentNullException("namespace");
            }

            return(Task.Factory.StartNew(() => {
                lock (SyncRoot) {
                    return GetFolders(@namespace, items, subscribedOnly, cancellationToken);
                }
            }, cancellationToken, TaskCreationOptions.None, TaskScheduler.Default));
        }
Beispiel #2
0
 /// <summary>
 /// Asynchronously get all of the folders within the specified namespace.
 /// </summary>
 /// <remarks>
 /// Asynchronously gets all of the folders within the specified namespace.
 /// </remarks>
 /// <returns>The folders.</returns>
 /// <param name="namespace">The namespace.</param>
 /// <param name="items">The status items to pre-populate.</param>
 /// <param name="subscribedOnly">If set to <c>true</c>, only subscribed folders will be listed.</param>
 /// <param name="cancellationToken">The cancellation token.</param>
 /// <exception cref="System.ArgumentNullException">
 /// <paramref name="namespace"/> is <c>null</c>.
 /// </exception>
 /// <exception cref="System.ObjectDisposedException">
 /// The <see cref="MailStore"/> has been disposed.
 /// </exception>
 /// <exception cref="ServiceNotConnectedException">
 /// The <see cref="MailStore"/> is not connected.
 /// </exception>
 /// <exception cref="ServiceNotAuthenticatedException">
 /// The <see cref="MailStore"/> is not authenticated.
 /// </exception>
 /// <exception cref="System.OperationCanceledException">
 /// The operation was canceled via the cancellation token.
 /// </exception>
 /// <exception cref="System.IO.IOException">
 /// An I/O error occurred.
 /// </exception>
 /// <exception cref="ProtocolException">
 /// A protocol error occurred.
 /// </exception>
 /// <exception cref="CommandException">
 /// The command failed.
 /// </exception>
 public abstract Task <IList <IMailFolder> > GetFoldersAsync(FolderNamespace @namespace, StatusItems items = StatusItems.None, bool subscribedOnly = false, CancellationToken cancellationToken = default(CancellationToken));
Beispiel #3
0
 /// <summary>
 /// Asynchronously get all of the folders within the specified namespace.
 /// </summary>
 /// <remarks>
 /// Asynchronously gets all of the folders within the specified namespace.
 /// </remarks>
 /// <returns>The folders.</returns>
 /// <param name="namespace">The namespace.</param>
 /// <param name="subscribedOnly">If set to <c>true</c>, only subscribed folders will be listed.</param>
 /// <param name="cancellationToken">The cancellation token.</param>
 /// <exception cref="System.ArgumentNullException">
 /// <paramref name="namespace"/> is <c>null</c>.
 /// </exception>
 /// <exception cref="System.ObjectDisposedException">
 /// The <see cref="MailStore"/> has been disposed.
 /// </exception>
 /// <exception cref="ServiceNotConnectedException">
 /// The <see cref="MailStore"/> is not connected.
 /// </exception>
 /// <exception cref="ServiceNotAuthenticatedException">
 /// The <see cref="MailStore"/> is not authenticated.
 /// </exception>
 /// <exception cref="System.OperationCanceledException">
 /// The operation was canceled via the cancellation token.
 /// </exception>
 /// <exception cref="System.IO.IOException">
 /// An I/O error occurred.
 /// </exception>
 /// <exception cref="ProtocolException">
 /// A protocol error occurred.
 /// </exception>
 /// <exception cref="CommandException">
 /// The command failed.
 /// </exception>
 public virtual Task <IList <IMailFolder> > GetFoldersAsync(FolderNamespace @namespace, bool subscribedOnly, CancellationToken cancellationToken = default(CancellationToken))
 {
     return(GetFoldersAsync(@namespace, StatusItems.None, subscribedOnly, cancellationToken));
 }
Beispiel #4
0
 /// <summary>
 /// Get the folder for the specified namespace.
 /// </summary>
 /// <remarks>
 /// Gets the folder for the specified namespace.
 /// </remarks>
 /// <returns>The folder.</returns>
 /// <param name="namespace">The namespace.</param>
 /// <exception cref="System.ArgumentNullException">
 /// <paramref name="namespace"/> is <c>null</c>.
 /// </exception>
 /// <exception cref="System.ObjectDisposedException">
 /// The <see cref="MailStore"/> has been disposed.
 /// </exception>
 /// <exception cref="ServiceNotConnectedException">
 /// The <see cref="MailStore"/> is not connected.
 /// </exception>
 /// <exception cref="ServiceNotAuthenticatedException">
 /// The <see cref="MailStore"/> is not authenticated.
 /// </exception>
 /// <exception cref="FolderNotFoundException">
 /// The folder could not be found.
 /// </exception>
 public abstract IMailFolder GetFolder(FolderNamespace @namespace);
Beispiel #5
0
		/// <summary>
		/// Asynchronously get all of the folders within the specified namespace.
		/// </summary>
		/// <remarks>
		/// Asynchronously gets all of the folders within the specified namespace.
		/// </remarks>
		/// <returns>The folders.</returns>
		/// <param name="namespace">The namespace.</param>
		/// <param name="items">The status items to pre-populate.</param>
		/// <param name="subscribedOnly">If set to <c>true</c>, only subscribed folders will be listed.</param>
		/// <param name="cancellationToken">The cancellation token.</param>
		/// <exception cref="System.ArgumentNullException">
		/// <paramref name="namespace"/> is <c>null</c>.
		/// </exception>
		/// <exception cref="System.ObjectDisposedException">
		/// The <see cref="MailStore"/> has been disposed.
		/// </exception>
		/// <exception cref="ServiceNotConnectedException">
		/// The <see cref="MailStore"/> is not connected.
		/// </exception>
		/// <exception cref="ServiceNotAuthenticatedException">
		/// The <see cref="MailStore"/> is not authenticated.
		/// </exception>
		/// <exception cref="System.OperationCanceledException">
		/// The operation was canceled via the cancellation token.
		/// </exception>
		/// <exception cref="System.IO.IOException">
		/// An I/O error occurred.
		/// </exception>
		/// <exception cref="ProtocolException">
		/// A protocol error occurred.
		/// </exception>
		/// <exception cref="CommandException">
		/// The command failed.
		/// </exception>
		public virtual Task<IEnumerable<IMailFolder>> GetFoldersAsync (FolderNamespace @namespace, StatusItems items = StatusItems.None, bool subscribedOnly = false, CancellationToken cancellationToken = default (CancellationToken))
		{
			if (@namespace == null)
				throw new ArgumentNullException ("namespace");

			return Task.Factory.StartNew (() => {
				lock (SyncRoot) {
					return GetFolders (@namespace, items, subscribedOnly, cancellationToken);
				}
			}, cancellationToken, TaskCreationOptions.None, TaskScheduler.Default);
		}
Beispiel #6
0
		/// <summary>
		/// Get all of the folders within the specified namespace.
		/// </summary>
		/// <remarks>
		/// Gets all of the folders within the specified namespace.
		/// </remarks>
		/// <returns>The folders.</returns>
		/// <param name="namespace">The namespace.</param>
		/// <param name="items">The status items to pre-populate.</param>
		/// <param name="subscribedOnly">If set to <c>true</c>, only subscribed folders will be listed.</param>
		/// <param name="cancellationToken">The cancellation token.</param>
		/// <exception cref="System.ArgumentNullException">
		/// <paramref name="namespace"/> is <c>null</c>.
		/// </exception>
		/// <exception cref="System.ObjectDisposedException">
		/// The <see cref="MailStore"/> has been disposed.
		/// </exception>
		/// <exception cref="ServiceNotConnectedException">
		/// The <see cref="MailStore"/> is not connected.
		/// </exception>
		/// <exception cref="ServiceNotAuthenticatedException">
		/// The <see cref="MailStore"/> is not authenticated.
		/// </exception>
		/// <exception cref="System.OperationCanceledException">
		/// The operation was canceled via the cancellation token.
		/// </exception>
		/// <exception cref="System.IO.IOException">
		/// An I/O error occurred.
		/// </exception>
		/// <exception cref="ProtocolException">
		/// A protocol error occurred.
		/// </exception>
		/// <exception cref="CommandException">
		/// The command failed.
		/// </exception>
		public abstract IEnumerable<IMailFolder> GetFolders (FolderNamespace @namespace, StatusItems items = StatusItems.None, bool subscribedOnly = false, CancellationToken cancellationToken = default (CancellationToken));
Beispiel #7
0
		/// <summary>
		/// Get all of the folders within the specified namespace.
		/// </summary>
		/// <remarks>
		/// Gets all of the folders within the specified namespace.
		/// </remarks>
		/// <returns>The folders.</returns>
		/// <param name="namespace">The namespace.</param>
		/// <param name="subscribedOnly">If set to <c>true</c>, only subscribed folders will be listed.</param>
		/// <param name="cancellationToken">The cancellation token.</param>
		/// <exception cref="System.ArgumentNullException">
		/// <paramref name="namespace"/> is <c>null</c>.
		/// </exception>
		/// <exception cref="System.ObjectDisposedException">
		/// The <see cref="MailStore"/> has been disposed.
		/// </exception>
		/// <exception cref="ServiceNotConnectedException">
		/// The <see cref="MailStore"/> is not connected.
		/// </exception>
		/// <exception cref="ServiceNotAuthenticatedException">
		/// The <see cref="MailStore"/> is not authenticated.
		/// </exception>
		/// <exception cref="System.OperationCanceledException">
		/// The operation was canceled via the cancellation token.
		/// </exception>
		/// <exception cref="System.IO.IOException">
		/// An I/O error occurred.
		/// </exception>
		/// <exception cref="ProtocolException">
		/// A protocol error occurred.
		/// </exception>
		/// <exception cref="CommandException">
		/// The command failed.
		/// </exception>
		public virtual IEnumerable<IMailFolder> GetFolders (FolderNamespace @namespace, bool subscribedOnly, CancellationToken cancellationToken = default (CancellationToken))
		{
			return GetFolders (@namespace, StatusItems.None, subscribedOnly, cancellationToken);
		}
Beispiel #8
0
		/// <summary>
		/// Get the folder for the specified namespace.
		/// </summary>
		/// <remarks>
		/// Gets the folder for the specified namespace.
		/// </remarks>
		/// <returns>The folder.</returns>
		/// <param name="namespace">The namespace.</param>
		/// <exception cref="System.ArgumentNullException">
		/// <paramref name="namespace"/> is <c>null</c>.
		/// </exception>
		/// <exception cref="System.ObjectDisposedException">
		/// The <see cref="MailStore"/> has been disposed.
		/// </exception>
		/// <exception cref="ServiceNotConnectedException">
		/// The <see cref="MailStore"/> is not connected.
		/// </exception>
		/// <exception cref="ServiceNotAuthenticatedException">
		/// The <see cref="MailStore"/> is not authenticated.
		/// </exception>
		/// <exception cref="FolderNotFoundException">
		/// The folder could not be found.
		/// </exception>
		public abstract IMailFolder GetFolder (FolderNamespace @namespace);
Beispiel #9
0
 /// <summary>
 /// Get all of the folders within the specified namespace.
 /// </summary>
 /// <remarks>
 /// Gets all of the folders within the specified namespace.
 /// </remarks>
 /// <returns>The folders.</returns>
 /// <param name="namespace">The namespace.</param>
 /// <param name="items">The status items to pre-populate.</param>
 /// <param name="subscribedOnly">If set to <c>true</c>, only subscribed folders will be listed.</param>
 /// <param name="cancellationToken">The cancellation token.</param>
 /// <exception cref="System.ArgumentNullException">
 /// <paramref name="namespace"/> is <c>null</c>.
 /// </exception>
 /// <exception cref="System.ObjectDisposedException">
 /// The <see cref="MailStore"/> has been disposed.
 /// </exception>
 /// <exception cref="ServiceNotConnectedException">
 /// The <see cref="MailStore"/> is not connected.
 /// </exception>
 /// <exception cref="ServiceNotAuthenticatedException">
 /// The <see cref="MailStore"/> is not authenticated.
 /// </exception>
 /// <exception cref="System.OperationCanceledException">
 /// The operation was canceled via the cancellation token.
 /// </exception>
 /// <exception cref="System.IO.IOException">
 /// An I/O error occurred.
 /// </exception>
 /// <exception cref="ProtocolException">
 /// A protocol error occurred.
 /// </exception>
 /// <exception cref="CommandException">
 /// The command failed.
 /// </exception>
 public abstract IEnumerable <IMailFolder> GetFolders(FolderNamespace @namespace, StatusItems items = StatusItems.None, bool subscribedOnly = false, CancellationToken cancellationToken = default(CancellationToken));
Beispiel #10
0
 /// <summary>
 /// Get all of the folders within the specified namespace.
 /// </summary>
 /// <remarks>
 /// Gets all of the folders within the specified namespace.
 /// </remarks>
 /// <returns>The folders.</returns>
 /// <param name="namespace">The namespace.</param>
 /// <param name="subscribedOnly">If set to <c>true</c>, only subscribed folders will be listed.</param>
 /// <param name="cancellationToken">The cancellation token.</param>
 /// <exception cref="System.ArgumentNullException">
 /// <paramref name="namespace"/> is <c>null</c>.
 /// </exception>
 /// <exception cref="System.ObjectDisposedException">
 /// The <see cref="MailStore"/> has been disposed.
 /// </exception>
 /// <exception cref="ServiceNotConnectedException">
 /// The <see cref="MailStore"/> is not connected.
 /// </exception>
 /// <exception cref="ServiceNotAuthenticatedException">
 /// The <see cref="MailStore"/> is not authenticated.
 /// </exception>
 /// <exception cref="System.OperationCanceledException">
 /// The operation was canceled via the cancellation token.
 /// </exception>
 /// <exception cref="System.IO.IOException">
 /// An I/O error occurred.
 /// </exception>
 /// <exception cref="ProtocolException">
 /// A protocol error occurred.
 /// </exception>
 /// <exception cref="CommandException">
 /// The command failed.
 /// </exception>
 public virtual IEnumerable <IMailFolder> GetFolders(FolderNamespace @namespace, bool subscribedOnly, CancellationToken cancellationToken = default(CancellationToken))
 {
     return(GetFolders(@namespace, StatusItems.None, subscribedOnly, cancellationToken));
 }
		public void TestArgumentExceptions ()
		{
			var enumeratedRights = new [] { AccessRight.OpenFolder, AccessRight.CreateFolder };

			Assert.Throws<ArgumentNullException> (() => new AccessControl (null));
			Assert.Throws<ArgumentNullException> (() => new AccessControl (null, "rk"));
			Assert.Throws<ArgumentNullException> (() => new AccessControl (null, enumeratedRights));
			Assert.Throws<ArgumentNullException> (() => new AccessControl ("name", (string) null));
			Assert.Throws<ArgumentNullException> (() => new AccessControl ("name", (IEnumerable<AccessRight>) null));

			Assert.Throws<ArgumentNullException> (() => new AccessControlList (null));

			Assert.Throws<ArgumentNullException> (() => new AccessRights ((IEnumerable<AccessRight>) null));
			Assert.Throws<ArgumentNullException> (() => new AccessRights ((string) null));

			var rights = new AccessRights ();
			Assert.Throws<ArgumentNullException> (() => rights.AddRange ((string) null));
			Assert.Throws<ArgumentNullException> (() => rights.AddRange ((IEnumerable<AccessRight>) null));

			Assert.Throws<ArgumentNullException> (() => new AlertEventArgs (null));

			Assert.Throws<ArgumentNullException> (() => new FolderNamespace ('.', null));

			var namespaces = new FolderNamespaceCollection ();
			FolderNamespace ns;

			Assert.Throws<ArgumentNullException> (() => namespaces.Add (null));
			Assert.Throws<ArgumentNullException> (() => namespaces.Contains (null));
			Assert.Throws<ArgumentNullException> (() => namespaces.Remove (null));
			Assert.Throws<ArgumentOutOfRangeException> (() => ns = namespaces[-1]);
			Assert.Throws<ArgumentOutOfRangeException> (() => namespaces[-1] = new FolderNamespace ('.', ""));

			namespaces.Add (new FolderNamespace ('.', ""));
			Assert.Throws<ArgumentNullException> (() => namespaces[0] = null);

			Assert.Throws<ArgumentNullException> (() => new FolderNotFoundException (null));
			Assert.Throws<ArgumentNullException> (() => new FolderNotFoundException ("message", null));
			Assert.Throws<ArgumentNullException> (() => new FolderNotFoundException ("message", null, new Exception ("message")));

			Assert.Throws<ArgumentNullException> (() => new FolderNotOpenException (null, FolderAccess.ReadOnly));
			Assert.Throws<ArgumentNullException> (() => new FolderNotOpenException (null, FolderAccess.ReadOnly, "message"));
			Assert.Throws<ArgumentNullException> (() => new FolderNotOpenException (null, FolderAccess.ReadOnly, "message", new Exception ("message")));

			Assert.Throws<ArgumentNullException> (() => new FolderRenamedEventArgs (null, "name"));
			Assert.Throws<ArgumentNullException> (() => new FolderRenamedEventArgs ("name", null));

			Assert.Throws<ArgumentOutOfRangeException> (() => new MessageEventArgs (-1));

			Assert.Throws<ArgumentNullException> (() => new MessageFlagsChangedEventArgs (0, MessageFlags.Answered, null));
			Assert.Throws<ArgumentNullException> (() => new MessageFlagsChangedEventArgs (0, MessageFlags.Answered, null, 1));
			Assert.Throws<ArgumentNullException> (() => new MessageFlagsChangedEventArgs (0, UniqueId.MinValue, MessageFlags.Answered, null));
			Assert.Throws<ArgumentNullException> (() => new MessageFlagsChangedEventArgs (0, UniqueId.MinValue, MessageFlags.Answered, null, 1));

			Assert.Throws<ArgumentNullException> (() => new MessageLabelsChangedEventArgs (0, null));
			Assert.Throws<ArgumentNullException> (() => new MessageLabelsChangedEventArgs (0, null, 1));
			Assert.Throws<ArgumentNullException> (() => new MessageLabelsChangedEventArgs (0, UniqueId.MinValue, null));
			Assert.Throws<ArgumentNullException> (() => new MessageLabelsChangedEventArgs (0, UniqueId.MinValue, null, 1));

			Assert.Throws<ArgumentNullException> (() => new MessageSentEventArgs (null, "response"));
			Assert.Throws<ArgumentNullException> (() => new MessageSentEventArgs (new MimeMessage (), null));

			Assert.Throws<ArgumentNullException> (() => new MessageSummaryFetchedEventArgs (null));

			Assert.Throws<ArgumentNullException> (() => new MessagesVanishedEventArgs (null, false));

			Assert.Throws<ArgumentNullException> (() => new MetadataCollection (null));

			var metadataOptions = new MetadataOptions ();
			Assert.Throws<ArgumentOutOfRangeException> (() => metadataOptions.Depth = 500);

			Assert.Throws<ArgumentOutOfRangeException> (() => new ModSeqChangedEventArgs (-1));
			Assert.Throws<ArgumentOutOfRangeException> (() => new ModSeqChangedEventArgs (-1, 1));
			Assert.Throws<ArgumentOutOfRangeException> (() => new ModSeqChangedEventArgs (-1, UniqueId.MinValue, 1));

			Assert.Throws<ArgumentOutOfRangeException> (() => new OrderBy (OrderByType.To, SortOrder.None));

			Assert.Throws<ArgumentNullException> (() => new ProtocolLogger ((string) null));
			Assert.Throws<ArgumentNullException> (() => new ProtocolLogger ((Stream) null));
			using (var logger = new ProtocolLogger (new MemoryStream ())) {
				var buffer = new byte[1024];

				Assert.Throws<ArgumentNullException> (() => logger.LogConnect (null));
				Assert.Throws<ArgumentNullException> (() => logger.LogClient (null, 0, 0));
				Assert.Throws<ArgumentNullException> (() => logger.LogServer (null, 0, 0));
				Assert.Throws<ArgumentOutOfRangeException> (() => logger.LogClient (buffer, -1, 0));
				Assert.Throws<ArgumentOutOfRangeException> (() => logger.LogServer (buffer, -1, 0));
				Assert.Throws<ArgumentOutOfRangeException> (() => logger.LogClient (buffer, 0, -1));
				Assert.Throws<ArgumentOutOfRangeException> (() => logger.LogServer (buffer, 0, -1));
			}

			Assert.Throws<ArgumentNullException> (() => new UniqueIdMap (null, new [] { UniqueId.MinValue }));
			Assert.Throws<ArgumentNullException> (() => new UniqueIdMap (new [] { UniqueId.MinValue }, null));
		}
 public Task<IEnumerable<IMailFolder>> GetFoldersAsync(FolderNamespace @namespace, bool subscribedOnly = false,
     CancellationToken cancellationToken = new CancellationToken())
 {
     return _imapClient.GetFoldersAsync(@namespace, subscribedOnly, cancellationToken);
 }
 public IMailFolder GetFolder(FolderNamespace @namespace)
 {
     return _imapClient.GetFolder(@namespace);
 }
Beispiel #14
0
		/// <summary>
		/// Asynchronously get all of the folders within the specified namespace.
		/// </summary>
		/// <remarks>
		/// Asynchronously gets all of the folders within the specified namespace.
		/// </remarks>
		/// <returns>The folders.</returns>
		/// <param name="namespace">The namespace.</param>
		/// <param name="subscribedOnly">If set to <c>true</c>, only subscribed folders will be listed.</param>
		/// <param name="cancellationToken">The cancellation token.</param>
		/// <exception cref="System.ArgumentNullException">
		/// <paramref name="namespace"/> is <c>null</c>.
		/// </exception>
		/// <exception cref="System.ObjectDisposedException">
		/// The <see cref="MailStore"/> has been disposed.
		/// </exception>
		/// <exception cref="ServiceNotConnectedException">
		/// The <see cref="MailStore"/> is not connected.
		/// </exception>
		/// <exception cref="ServiceNotAuthenticatedException">
		/// The <see cref="MailStore"/> is not authenticated.
		/// </exception>
		/// <exception cref="System.OperationCanceledException">
		/// The operation was canceled via the cancellation token.
		/// </exception>
		/// <exception cref="System.IO.IOException">
		/// An I/O error occurred.
		/// </exception>
		/// <exception cref="ProtocolException">
		/// A protocol error occurred.
		/// </exception>
		/// <exception cref="CommandException">
		/// The command failed.
		/// </exception>
		public virtual Task<IList<IMailFolder>> GetFoldersAsync (FolderNamespace @namespace, bool subscribedOnly, CancellationToken cancellationToken = default (CancellationToken))
		{
			if (@namespace == null)
				throw new ArgumentNullException (nameof (@namespace));

			return Task.Factory.StartNew (() => {
				lock (SyncRoot) {
					return GetFolders (@namespace, subscribedOnly, cancellationToken);
				}
			}, cancellationToken, TaskCreationOptions.None, TaskScheduler.Default);
		}