Example #1
0
        public ImapMailboxList(IImapMailboxFlagSet nameAttributes, string hierarchyDelimiter, string name)
        {
            if (nameAttributes == null)
            throw new ArgumentNullException("nameAttributes");
              if (name == null)
            throw new ArgumentNullException("name");

              this.NameAttributes = nameAttributes;
              this.HierarchyDelimiter = hierarchyDelimiter;
              this.Name = name;

              this.ChildInfo = null;
        }
        /// <summary>sends CREATE command</summary>
        /// <remarks>
        /// valid in authenticated state.
        /// this method will fail if server does not support CREATE-SPECIAL-USE extension.
        /// </remarks>
        public ImapCommandResult CreateSpecialUse(string mailboxName, IImapMailboxFlagSet useFlags, out ImapMailbox createdMailbox)
        {
            if (useFlags == null)
            throw new ArgumentNullException("useFlags");

              foreach (var useFlag in useFlags) {
            if (!ImapMailboxFlag.UseFlags.Has(useFlag))
              throw new ArgumentException(string.Format("must be one of use-flag. '{0}' is invalid.", useFlag),
                                      "useFlags");
              }

              using (var t = new CreateTransaction(connection, ImapCapability.CreateSpecialUse)) {
            var result = CreateInternal(t,
                                    mailboxName,
                                    new ImapParenthesizedString("USE", new ImapParenthesizedString(useFlags.ToArray())),
                                    out createdMailbox);

            if (result.Succeeded)
              createdMailbox.Flags = (new ImapMailboxFlagList(useFlags)).AsReadOnly();

            return result;
              }
        }
        /// <summary>sends CREATE command</summary>
        /// <remarks>
        /// valid in authenticated state.
        /// this method will fail if server does not support CREATE-SPECIAL-USE extension.
        /// </remarks>
        public ImapCommandResult CreateSpecialUse(string mailboxName, IImapMailboxFlagSet useFlags)
        {
            ImapMailbox discard;

              return CreateSpecialUse(mailboxName, useFlags, out discard);
        }