Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
Intimatik  
#1 Posted : Thursday, April 7, 2011 9:35:24 PM(UTC)
Intimatik

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?
ivan  
#2 Posted : Thursday, April 7, 2011 10:41:27 PM(UTC)
ivan

Rank: Administration

Groups: Administrators
Joined: 11/11/2010(UTC)
Posts: 1,154

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

thanks 1 user thanked ivan for this useful post.
Intimatik on 4/7/2011(UTC)
Intimatik  
#3 Posted : Friday, April 8, 2011 3:17:30 AM(UTC)
Intimatik

Rank: Newbie

Groups: Registered
Joined: 1/28/2011(UTC)
Posts: 5
Location: NZ

Thanks: 1 times
It works! Thanks!
ditte  
#4 Posted : Monday, April 11, 2011 2:53:52 AM(UTC)
ditte

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
ditte  
#5 Posted : Monday, April 11, 2011 3:47:44 AM(UTC)
ditte

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
Users browsing this topic
Guest
Forum Jump  
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.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.074 seconds.

EXPLORE TUTORIALS

© All Rights Reserved, AIFEI Software Limited & AdminSystem Software Limited.