Link to home
Start Free TrialLog in
Avatar of purplesoup
purplesoupFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Sent Emails not appearing in list

I am running GroupWise 7, using Visual Basic and the GroupWise COM API

I have an application that lists GroupWise emails in the sent folder.

I have been told by a user (who it running GroupWise 6.5) that the application does not list all the emails in their sent items folder - they have over a 1,000 and only a small number (about 20) are actually being listed.

The code I am using to list the messages is:

Set GetSentItemsMessageList = gGw.RootAccount.MailBox.Messages.Find("(BOX_TYPE = OUTGOING AND CREATE_DATE >= TODAY -500)")

According to the user "I can see messages from 15/03/2006 12:03 to 20/3/2006 09:48 even though there are emails before this and a few after."

Any thoughts on why not all the emails are being listed?
Avatar of ShineOn
ShineOn
Flag of United States of America image

It may be the "today - 500."  Have you verified that that calculation will give you a date that's a year-and-a-half in the past?  

Or, maybe for some goofy reason, you need to group the calc in parentheses or something... ;)

Or, maybe don't filter on date, just on box type.
Avatar of purplesoup

ASKER

All good points.

The actual value isn't fixed - the user can control it. The user started at a default of 50 and tried various settings, but they did not appear to alter what was being returned. If the user tries it with no date calculation - so the search is just "(BOX_TYPE = OUTGOING)" he says he gets "a 440 error" (I am assuming this is a VB 440 automation error - he hasn't sent any further details).

If the same user runs these searches on their inbox it all works well - he can alter the number of days to search etc. So in this case the search will be:

(BOX_TYPE = INCOMING AND CREATE_DATE>=TODAY -50)

So it is only the sent items folder the user is reporting problems with.

So to summarise: everything we want to do with sent items the user can do successfully with inbox, but just not with sent items.
2.
ASKER CERTIFIED SOLUTION
Avatar of ShineOn
ShineOn
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Just for the record, I have a utility app which I use to help with debugging, and this lists the same emails as the main application, the code however is much simpler:

    mailListBox.Clear
    Set msgList = gw.RootAccount.MailBox.Messages.Find(searchString)
   
    If Not msgList Is Nothing Then
        For Each msg In msgList
            mailListBox.AddItem msg.ClassName & " " & msg.Subject
        Next msg
    End If
   
    Set gw = Nothing
 
Anyway, I have had a look at the sample code you mentioned and interestingly it uses a different method for listing messages. It enumerates all the GroupWise folders and then presents these to the user as a drop down list. The user then clicks on the list and the messages in the folder display. Thus the messages are listed using this code:

Set GWMessages = GWFolders(cboFolders.ListIndex).Messages

where GWFolders is set from

Set GWFolders = GWRootAccount.AllFolders

I turned this code into a little utility and sent it to the user who was having problems, and hey presto they can see all their sent items.

So it just seems to me that searching for messages using search filter strings, such as with:

Set GetSentItemsMessageList = gGw.RootAccount.MailBox.Messages.Find("(BOX_TYPE = OUTGOING AND CREATE_DATE >= TODAY -50)")

is just not reliable, certainly with GroupWise 6.5, and the alternative method as accessing the folders by number, has to be used.

Any thoughts?
I can't help thinking it may be a limitation of VB?  I get the sense that the messages.find method you're using works, but isn't enumerating everything it finds like the method in the sample code is, so what's displayed isn't what's expected.  
That may be true, but the example does an enumeration after getting the message list:

       Set GWMessages = GWFolders(cboFolders.ListIndex).Messages            
       For Each objMessage In GWMessages


Well, I'll close this as I have a workaround - thanks for your help