Exemple #1
0
        /// <summary>
        /// Retreives a folder from the mailbox with the specified ID
        /// </summary>
        /// <param name="id">ID of folder to find</param>
        /// <returns>IFolder object, or null if ID not found</returns>
        public IFolder GetFolderByID(int id)
        {
            Mailbox.FolderDataTable folderTable =
                _client.DataManager.FolderTable;

            Mailbox.FolderRow[] rows = (Mailbox.FolderRow[])folderTable.Select(String.Format("ID = {0}", id));
            if (rows.Length == 1)
            {
                return(new Folder(_client, rows[0].ID));
            }

            throw new ArgumentOutOfRangeException(String.Format("No folder with ID {0} found.", id));
        }
Exemple #2
0
        /// <summary>
        /// Returns the list of folders that have their parent sent to the ID of rootFolder
        /// </summary>
        /// <param name="rootFolder"></param>
        /// <returns></returns>
        public IFolder[] GetChildFolders(IFolder rootFolder)
        {
            int rootID = rootFolder == null ? -1 : rootFolder.ID;

            Mailbox.FolderDataTable folderTable = _client.DataManager.FolderTable;
            List <IFolder>          folders     = new List <IFolder>();

            foreach (Mailbox.FolderRow row in folderTable.Select(String.Format("ParentID = {0}", rootID)))
            {
                folders.Add(new Folder(_client, row.ID));
            }

            return(folders.ToArray());
        }
Exemple #3
0
        /// <summary>
        /// Get a list of all of the specified folders child folders
        /// </summary>
        /// <param name="parentFolder">The folder of which to get the children</param>
        /// <returns>Array of child folders</returns>
        public IFolder[] GetSubFolders(IFolder parentFolder)
        {
            if (parentFolder == null)
            {
                return(GetAllFolders());
            }

            Mailbox.FolderDataTable folderTable = _client.DataManager.FolderTable;
            List <IFolder>          folders     = new List <IFolder>();

            foreach (Mailbox.FolderRow row in folderTable.Select(String.Format("ParentID = {0}", parentFolder.ID)))
            {
                folders.Add(new Folder(_client, row.ID));
            }

            return(folders.ToArray());
        }