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?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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.
purplesoupAuthor Commented:
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:


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.
I realize that it's a semantics thing, but just in case anyone wasn't sure about it - there's only one mailbox, containing received items and sent items, and all of the "folders" are just views of the mailbox with filters on type... and the item types include mail, appointments, tasks, notes, etc. so, the "sent items folder" is actually a search query on the mailbox for type email, outgoing.   This has nothing to do with the Question, though - just a parenthetical comment.

That said, have you looked at this sample VB code?  It may help, it may not, but sometimes it's nice to see what others have done in the same vein:

I don't see anything wrong with your logic or syntax from what you've got posted.  May be somewhere other than in the statement using the message.find method, like where the found messages get enumerated or something...


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

purplesoupAuthor Commented:
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:

    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.  
purplesoupAuthor Commented:
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.