ImapClient.GetAllFolders C# (CSharp) Method

GetAllFolders() public method

public GetAllFolders ( ) : List
return List
    public List<string> GetAllFolders()
    {
        string tagStr = GetTag();
        writestreamdata(tagStr + "LIST \"\" \"*\"\r\n");
        List<string> data = readstreamdata(tagStr + "OK");
        Regex r = new Regex("[*] LIST [(][^)]+[)] [\"]/[\"] [\"](?<FolderName>.+)[\"]");
        List<string> foldernames = new List<string>();
        foreach (string str in data)
        {
            //* LIST (\HasNoChildren) "/" "Appointments"
            Match m = r.Match(str);
            if (m.Groups["FolderName"] != null && m.Groups["FolderName"].Value != null && m.Groups["FolderName"].Value.Length > 0)
            {
                foldernames.Add(m.Groups["FolderName"].Value);
            }
        }
        return foldernames;
    }

Usage Example

コード例 #1
0
 public void getFolders(string canvasid, int windowid)
 {
     ImapClient imp = new ImapClient(ccl.InputParams[2].ToString(), 993, ccl.InputParams[0].ToString(), ccl.InputParams[1].ToString(), true);
     List<string> mailboxes = imp.GetAllFolders();
     foreach(string mb in mailboxes){
         parameters.Add(mb);
     }
     imp.Logout();
 }
All Usage Examples Of ImapClient::GetAllFolders