Gets the sub-folders of current folder.
This property is
obsoleted by Imap4Folder.SubFolderList
[Visual Basic 6.0] Public Property Get SubFolders() As Variant
[Visual C++] public: get_SubFolders( VARIANT* pVal );
Property Value
Example
[Visual Basic 6.0, VBScript, Visual C++] The following sample demonstrates how to enumerate all folders on IMAP4 folder. To get the full samples of EAGetMail, please refer to Samples section.
[Visual Basic 6.0] Public Sub ConnectImapServer(ByVal Server As String, _ ByVal User As String, _ ByVal Password As String, _ ByVal SSLConnection As Boolean) Const MailServerPop3 = 0 Const MailServerImap4 = 1 Const MailServerEWS = 2 Const MailServerDAV = 3 Const MailServerMsGraph = 4 On Error GoTo ErrorHandle Dim oServer As New EAGetMailObjLib.MailServer oServer.Server = Server oServer.User = User oServer.Password = Password oServer.SSLConnection = SSLConnection oServer.Protocol = MailServerImap4 'To manage folder with Exchange Web Service, please change 'MailServerImap4 to MailServerEWS to MailServer.Protocol 'To manage folder email with Exchange WebDAV, please change 'MailServerImap4 to MailServerDAV to MailServer.Protocol 'Exchange Server supports POP3/IMAP4 protocol as well, but in Exchange 2007 'or later version, POP3/IMAP4 service is disabled by default. If you don't want to use POP3/IMAP4 'to download email from Exchange Server, you can use Exchange Web Service(Exchange 2007/2010 or 'later version) or WebDAV(Exchange 2000/2003) protocol. 'For Exchange Web Service/WebDAV, please ignore 'Port property. But for Exchange Web Service, please set SSLConnection to True If oServer.SSLConnection = True Then oServer.Port = 993 Else oServer.Port = 143 End If Dim oClient As New EAGetMailObjLib.MailClient oClient.LicenseCode = "TryIt" oClient.Connect oServer Dim arFolder arFolder = oClient.Imap4Folders 'enumerates all folders on IMAP4/Exchange server. EnumerateFolder arFolder oClient.Logout Exit Sub ErrorHandle: MsgBox Err.Description End Sub Public Sub EnumerateFolder(oFolders) Dim i, count As Integer count = UBound(oFolders) For i = LBound(oFolders) To count Dim oFolder As EAGetMailObjLib.Imap4Folder Set oFolder = oFolders(i) Dim s s = "Name: " & oFolder.Name & Chr(13) & Chr(10) s = s & "FullPath: " & oFolder.FullPath & Chr(13) & Chr(10) s = s & "LocalPath: " & oFolder.LocalPath & Chr(13) & Chr(10) s = s & "Flags: " & oFolder.IMAP4FolderFlags & Chr(13) & Chr(10) s = s & "Subscribed: " & oFolder.Subscribed & Chr(13) & Chr(10) MsgBox s EnumerateFolder oFolder.SubFolders Next End Sub
[VBScript] Public Sub ConnectImapServer(ByVal Server, _ ByVal User, _ ByVal Password, _ ByVal SSLConnection) Const MailServerPop3 = 0 Const MailServerImap4 = 1 Const MailServerEWS = 2 Const MailServerDAV = 3 Const MailServerMsGraph = 4 Dim oServer Set oServer = CreateObject("EAGetMailObj.MailServer") oServer.Server = Server oServer.User = User oServer.Password = Password oServer.SSLConnection = SSLConnection oServer.Protocol = MailServerImap4 'To manage folder with Exchange Web Service, please change 'MailServerImap4 to MailServerEWS to MailServer.Protocol 'To manage folder email with Exchange WebDAV, please change 'MailServerImap4 to MailServerDAV to MailServer.Protocol 'Exchange Server supports POP3/IMAP4 protocol as well, but in Exchange 2007 'or later version, POP3/IMAP4 service is disabled by default. If you don't want to use POP3/IMAP4 'to download email from Exchange Server, you can use Exchange Web Service(Exchange 2007/2010 or 'later version) or WebDAV(Exchange 2000/2003) protocol. 'For Exchange Web Service/WebDAV, please ignore 'Port property. But for Exchange Web Service, please set SSLConnection to True If oServer.SSLConnection = True Then oServer.Port = 993 Else oServer.Port = 143 End If Dim oClient Set oClient = CreateObject("EAGetMailObj.MailClient") oClient.LicenseCode = "TryIt" oClient.Connect oServer Dim arFolder arFolder = oClient.Imap4Folders 'enumerates all folders on IMAP4/Exchange server. EnumerateFolder arFolder oClient.Logout End Sub Public Sub EnumerateFolder(oFolders) Dim i, count count = UBound(oFolders) For i = LBound(oFolders) To count Dim oFolder Set oFolder = oFolders(i) Dim s s = "Name: " & oFolder.Name & Chr(13) & Chr(10) s = s & "FullPath: " & oFolder.FullPath & Chr(13) & Chr(10) s = s & "LocalPath: " & oFolder.LocalPath & Chr(13) & Chr(10) s = s & "Flags: " & oFolder.IMAP4FolderFlags & Chr(13) & Chr(10) s = s & "Subscribed: " & oFolder.Subscribed & Chr(13) & Chr(10) MsgBox s EnumerateFolder oFolder.SubFolders Next End Sub
[Visual C++] #include "stdafx.h" #include <windows.h> #include "eagetmailobj.tlh" using namespace EAGetMailObjLib; void EnumerateFolder( _variant_t &arFolder ) { SAFEARRAY *psa = arFolder.parray; LONG UBound = 0, LBound = 0; SafeArrayGetLBound( psa, 1, &LBound ); SafeArrayGetUBound( psa, 1, &UBound ); for( long i = LBound; i <= UBound; i++ ) { _variant_t vt; SafeArrayGetElement( psa, &i, &vt ); IImap4FolderPtr oFolder; vt.pdispVal->QueryInterface( __uuidof(IImap4Folder), (void**)&oFolder ); _tprintf( _T("Name: %s\r\n"), (TCHAR*)oFolder->Name ); _tprintf( _T("FullPath: %s\r\n"), (TCHAR*)oFolder->FullPath ); _tprintf( _T("LocalPath: %s\r\n"), (TCHAR*)oFolder->LocalPath ); _tprintf( _T("Flags: %s\r\n"), (TCHAR*)oFolder->IMAP4FolderFlags ); if( oFolder->Subscribed == VARIANT_TRUE ) _tprintf( _T("Subscribed: True\r\n\r\n")); else _tprintf( _T("Subscribed: False\r\n\r\n")); _variant_t vtFolders = oFolder->SubFolders; EnumerateFolder( vtFolders ); } } void ConnectImap4Server( LPCTSTR lpszServer, LPCTSTR lpszUser, LPCTSTR lpszPassword, VARIANT_BOOL SSLConnection ) { ::CoInitialize( NULL ); const int MailServerPop3 = 0; const int MailServerImap4 = 1; const int MailServerEWS = 2; const int MailServerDAV = 3; const int MailServerMsGraph = 4; try { IMailServerPtr oServer = NULL; oServer.CreateInstance(__uuidof(EAGetMailObjLib::MailServer)); oServer->Server = lpszServer; oServer->User = lpszUser; oServer->Password = lpszPassword; oServer->SSLConnection = SSLConnection; oServer->Protocol = MailServerImap4; //To manage folder with Exchange Web Service, please change //MailServerImap4 to MailServerEWS to MailServer.Protocol //To manage folder email with Exchange WebDAV, please change //MailServerImap4 to MailServerDAV to MailServer.Protocol //Exchange Server supports POP3/IMAP4 protocol as well, but in Exchange 2007 //or later version, POP3/IMAP4 service is disabled by default. If you don't want to use POP3/IMAP4 //to download email from Exchange Server, you can use Exchange Web Service(Exchange 2007/2010 or //later version) or WebDAV(Exchange 2000/2003) protocol. //For Exchange Web Service/WebDAV, please ignore //Port property. But for Exchange Web Service, please set SSLConnection to True if( SSLConnection == VARIANT_TRUE ) oServer->Port = 993; else oServer->Port = 143; IMailClientPtr oClient = NULL; oClient.CreateInstance(__uuidof(EAGetMailObjLib::MailClient)); oClient->LicenseCode = _T("TryIt"); oClient->Connect( oServer ); _variant_t vtFolders = oClient->Imap4Folders; //enumerates all folders on IMAP4/Exchange server. EnumerateFolder( vtFolders ); } catch( _com_error &ep ) { ::_tprintf( _T("%s\r\n"), (TCHAR*)ep.Description() ); } ::CoUninitialize(); }
See Also
MailClient.Imap4Folders Property
MailClient.GetFolderList Method
MailClient.CreateFolder Method
MailClient.DeleteFolder Method
MailClient.Move Method
MailClient.Copy Method
MailClient.SelectFolder Method
Online Tutorials
Manage Mail Folders in VB6
Manage Mail Folders in Delphi
Manage Mail Folders in VC++