Rank: Newbie
Groups: Registered
Joined: 1/28/2011(UTC) Posts: 5 Location: NZ
Thanks: 1 times
I've got 1000+ imap folders . Everytime i search for a folder i'm making a new loop to find in collection of folders by name. It takes much time. Is there any possibility to make it faster?
Rank: Administration
Groups: Administrators
Joined: 11/11/2010(UTC) Posts: 1,153
Thanks: 9 times Was thanked: 55 time(s) in 55 post(s)
Intimatik wrote: I've got 1000+ imap folders . Everytime i search for a folder i'm making a new loop to find in collection of folders by name. It takes much time. Is there any possibility to make it faster?
You can use this method to select the imap4 folder directly.
VB6
Code:
Dim oFolder As New Imap4Folder
oFolder.ServerPath = "Deleted Items"
oFolder.FullPath = "Deleted Items"
oClient.SelectFolder oFolder
The problem problem is: you must know the folder server path.
I suggest that you use loop to get all folders server path at first, then you can use server path to select the folder directly.
VB6
Code:
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
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
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 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
' You can get the FullPath and ServerPath like this, then you can
' save it to a configuration file, next time you can use FullPath and ServerPath
' to access this folder directly
s = "Name: " & oFolder.Name & Chr(13) & Chr(10)
s = s & "FullPath: " & oFolder.FullPath & Chr(13) & Chr(10)
s = s & "ServerPath: " & oFolder.ServerPath & Chr(13) & Chr(10)
MsgBox s
EnumerateFolder oFolder.SubFolders
Next
End Sub
Edited by user Thursday, April 7, 2011 10:53:00 PM(UTC)
| Reason: Not specified
1 user thanked ivan for this useful post.
Rank: Newbie
Groups: Registered
Joined: 1/28/2011(UTC) Posts: 5 Location: NZ
Thanks: 1 times
Rank: Member
Groups: Registered
Joined: 2/5/2011(UTC) Posts: 15 Location: Germany, Berlin
How is the syntax, if the folder has subfolder and I want use one of this?
Quote: Dim oFolder As New Imap4Folder oFolder.ServerPath = "INBOX/Fax-Journal" oFolder.FullPath = "INBOX/Fax-Journal" oClient.SelectFolder oFolder
Rank: Member
Groups: Registered
Joined: 2/5/2011(UTC) Posts: 15 Location: Germany, Berlin
found it.
Quote: Dim oFolder As New Imap4Folder oFolder.ServerPath = "INBOX.Fax-Journal" oFolder.FullPath = "INBOX.Fax-Journal" oClient.SelectFolder oFolder
Forum Jump
EmailArchitect Support
Email Component Development
- EASendMail SMTP Component - .NET Version
- EASendMail SMTP Component - Windows Store Apps
- EASendMail SMTP ActiveX Object
- EAGetMail POP3 & IMAP4 Component - .NET Version
- EAGetMail POP3 & IMAP4 ActiveX Object
Exchange Server and IIS SMTP Plugin
- DomanKeys/DKIM for Exchange Server and IIS SMTP
- Disclaimer and S/MIME for Exchange Server and IIS
EmailArchitect Email Server
- EmailArchitect Email Server (General)
- EmailArchitect Email Server Development
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.