Results 1 to 3 of 3

Thread: Searching the mailbox

Threaded View

  1. Searching the mailbox


    I have a task that I need to be able todo, using C# is preffered ;)
    - One is list all unread email messages from the inbox.

    I've already got a working code to do this, but its terribly slow compared to using the GroupWise client.
    In my own inbox, it takes roughly 1,5 seconds to list every unread email using the code below.
    Using the builtin search, doing an advanced search using the same filters is instant.

                Console.Write("Mailserver #: ");
                string sMailServer = Console.ReadLine();
                string sCmdLine = "/*ipa*-mail" + sMailServer + "_whatever.whatever.whatever.no /ipp-1677";
                Console.Write("Username: ");
                sUserName = Console.ReadLine();
                //Console.WriteLine("Brukernavn = " + sUserName);
                Console.Write("Password: ");
                //sPassword = Console.ReadLine();
                sPassword = ReadPassword();
                //Console.WriteLine("Passord = " + sPassword);
                Console.WriteLine("MessageFilter: " + sMessageFilter);
                Stopwatch sw = new Stopwatch();
                //GroupwareTypeLibrary.Application5 objGWSession = new GroupwareTypeLibrary.Application5();
                GroupwareTypeLibrary.Application5 objGWSession = new GroupwareTypeLibrary.Application5();
                GroupwareTypeLibrary.Account objAccount = default(GroupwareTypeLibrary.Account);
                    objAccount = objGWSession.MultiLogin(sUserName, sCmdLine, sPassword, sWhenToPromp, sReserved);
                catch (Exception ex)
                    Console.WriteLine("Error in login: " + ex.Message);
                Console.WriteLine("Eier av Postkasse = " + objAccount.Owner.DisplayName);
                int i = 0;
                    //GroupwareTypeLibrary.MessageList mesList = objAccount.AllMessages.Find(sMessageFilter);
                    GroupwareTypeLibrary.MessageList mesList = objAccount.MailBox.FindMessages(sMessageFilter);
                    foreach (GroupwareTypeLibrary.Message message in mesList)
                        string msg = message.Subject.PlainText;
                        string msgfrom = message.Sender.DisplayName.ToString();
                        //string sStartDate = dtEndDate.ToString();
                        //string sEndDate = dtEndDate.ToString();
                        //Console.WriteLine("Fra: " + msgfrom);
                        //Console.WriteLine("Emne: " + msg);
                catch (Exception ex)
                    Console.WriteLine("Error in messagelist: " + ex.Message);
                    Console.WriteLine("Error in messagelist: " + ex.InnerException);
                Console.WriteLine("Unread emails = " + i);
                Console.WriteLine("In milliseconds: {0}", sw.ElapsedMilliseconds);
                Console.WriteLine("Done, press any key to continue...");
    On my largest GroupWise user, this operation takes upwards to 60 seconds todo (+70K emails to go through, around 600 unread)
    When we use the GroupWise client, this takes 2 seconds.
    Note: All our clients are set to online and doesnt cache locally.
    (I need to extract the header of the email aswell as the sender too, but commented out for this sample)

    What I've seen on the servers when we use the Object API todo this, is that it takes a while without any response on the client side, but at the server side the CPU load goes up 30-40% before sending the list over email's to the client.

    I havent seen this when the normal client is used to the same extent.

    Any ideas on how I can speed this up? I dont think I am pointing it to the actual inbox, since it also takes some emails outside of this, maybe thats an error too?

    (We've already got a solution like this by using SOAP, but thats even slower then using this method, even with dedicated PO's)
    Last edited by kgroneman; 07-Dec-2009 at 08:48 PM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts