Getting different message count for some mail boxes in a particular account

Hello,
I am using java mail api in my project.
I am using two methods
Case 1 :
folder.getMessageCount()
case 2:
getMessageCount(String folderName){
int iCount = 0;
Folder objFolder = store.getDefaultFolder();
if (folderName != null && folderName.equalsIgnoreCase("") == false) {
objFolder = objFolder.getFolder(folderName);
iCount = objFolder.getMessageCount();
return iCount;
I am getting different output from both the above cases.
I have tested both cases on many accounts and they give me same message count. but for one gmail account only they give me different message count for two folders, Inbox as well as Gmail/All.
Can anyone tell me the reason for this difference.

Yes, in case 1, i first open the folder and then i call folder.getMessageCount().
I am using IMAP in both the cases
as i used Store store = session.getStore("imaps");
Yes, there is no new mail delivered to the folder when this methods are analyzed.
i am getting different count as
imap.getMessageCount() >> First way
imap.getMessageCount(Bi testing) >> Another way:-
imap.getMessageCount(Bi testing)--> Count = 4
imap.getMessageCount()--> Count = 4
imap.getMessageCount(INBOX)--> Count = 125
imap.getMessageCount()--> Count = 117
imap.getMessageCount(Personal)--> Count = 11
imap.getMessageCount()--> Count = 11
imap.getMessageCount(Receipts)--> Count = 6
imap.getMessageCount()--> Count = 6
imap.getMessageCount(Travel)--> Count = 36
imap.getMessageCount()--> Count = 36
imap.getMessageCount(Work)--> Count = 2
imap.getMessageCount()--> Count = 2
*imap.getMessageCount([Gmail]/All Mail)--> Count = 180*
imap.getMessageCount()--> Count = 161
imap.getMessageCount([Gmail]/Drafts)--> Count = 0
imap.getMessageCount()--> Count = 0
imap.getMessageCount([Gmail]/Sent Mail)--> Count = 40
imap.getMessageCount()--> Count = 40
imap.getMessageCount([Gmail]/Spam)--> Count = 0
imap.getMessageCount()--> Count = 0
imap.getMessageCount([Gmail]/Starred)--> Count = 0
imap.getMessageCount()--> Count = 0
imap.getMessageCount([Gmail]/Trash)--> Count = 15
imap.getMessageCount()--> Count = 15
In this two folders Inbox as well as [Gmail]/All Mail showing different counts when used on both methods.

Similar Messages

  • Any way to get the mail app to get updated message counts for other folders

    I've been wondering if there's a way to get the mail app to not only check if new mail exists in my main "inbox", but also all of the folders on my imap server? I can individually visit each folder I'm interested in and while it works, I have to guess what folders might have mail in them.. It would be great to have the phone check all folders (or perhaps a list of subscribed folders) for new mail on a regular basis.. Any ideas?

    I have opened a wrap-up thread related to the issue reported here and in many other threads -- "iPhone Mail does not poll IMAP subfolders for server-side processed e-mails": http://discussions.apple.com/thread.jspa?threadID=1355852

  • When I sync my Iphone4 on Itunes I get a message saying that some apps cannot update because they are not compatible with my phone...also...Mail wont up/download...my provider adamant I have all the right settings..

    When I sync my Iphone4 on Itunes I get a message saying that some apps (eg Find Friends) cannot update because its not compatible with my phone.
    I also am not able to up/download mail even though my Provider is adamant the setting are correct...
    IOS 7.1.2
    would appreciate help with these issues :-)

    However after part of the Itune update completed a message came up on the screen
    saying   "The feature you are trying to use is on a net work resource that is unavailable.
    Which particular .msi file does the message go on to say cannot be found? (Several different .msi files might be mentioned in this context: itunes.msi, bonjour.msi, AppleSoftwareUpdate.msi, etc.)

  • Why am I getting this message on my e-mail account: User account temporarily unavailable for system maintenance

    Why am I getting this message on my e-mail account: User account temporarily unavailable for system maintenance?

    Is there a solution to this issue?  I have an iPhone and an iPad that sync with Outlook using iTunes.  Every now and then the contacts, calander and notes become unchecked for both the iPhone and iPad.  When I recheck them and "Apply" I get this message:  The information on the iPad is synced with another user account.  Do you want to sync this iPad with the information from this user account?
    As far as U know I have only one User Account.  I see that many people have this issue.  why isn't there a solution?

  • When I open my mail account I keep getting the message "Checking for Mail". I deleted the yahoo account and set it up again and I am still getting the same issue plus I am not seeing any of my mail or folders. Can anyone help?

    When I open my mail account I keep getting the message "Checking for Mail". I deleted the yahoo account and set it up again and I am still getting the same issue plus I am not seeing any of my mail or folders. Can anyone help?

    This is how I fixed it on my new iPhone 5S. Using the standard yahoo setting on my phone.
    You will have to access  "managing your app passwords" on your account profile for yahoo. Generate password for your app. For example: "My iPhone 5S'
    Go to your Iphone and set up your yahoo mail account on your phone the normal way and you have to use the generated password.  instead of the yahoo account password.
    source:
    http://virtualizeme.net/iphone-5-yahoo-mail-server-unavailable-fix/
    I hope this helps,
    cheers

  • For some reason I have two iCloud accounts in my Mac Mail App.  How do I get rid of one of these?

    For some reason I have two iCloud accounts in my Mac Mail App.  How do I get rid of one of these?

    Welcome to the Apple Community.
    mail > preferences > accounts, select the account and use the small minus icon in the bottom left corner.

  • I am being asked for the password for my btinternet account however when I supply it I get a message saying there is an error in the internet accounts preference pane

    I am being asked for the password for my btinternet account however when I enter it I get a message saying there is an error in the internet accounts preference pane. How can I resolve this?

    BT have made some changes to their email services recently (http://bt.custhelp.com/app/answers/detail/a_id/44789/) so you may be having problems because of this. I was certainly having problems, although I don't think that they were exactly the same as yours, and resolved it by creating a new account called something new. If you haven't deleted any mail from the BT webmail, when you create a new account on your Mac, it will mirror everything on webmail as it is an IMAP account. Once you are happy that the new account is working properly and that you haven't lost any messages, you can delete the old account.

  • Trying to install iCloud on Win7 get error message either no default mail client or current mail client cannot fulfill messaging request.   How fix?

    Trying to install iCloud on Win7 get error message either no default mail client or current mail client cannot fulfill messaging request.   How fix?

    Outlook 2013.  Under Start Up Options, I have checked "Make Outlook the default program for E-mail, Contacts, and Calendar".

  • How can I get the shutter count for my Canon 7D Mark II using Windows XP?

    How can I get the shutter count for my Canon 7D Mark II using Windows XP? I've been looking lots of places and doing some file uploads, but I can't seem to find anything. I'm wary of downloading software I know nothing about. Any help is greatly appreciated.
    Solved!
    Go to Solution.

    Nevermind, just, sort of answered my own question. Doesn't work on XP, but using a Win 7 'puter I was able to use Shutter Count, which now works w/ the 7D Mark II.

  • Problem w/: Error while getting estimated row count for view

    JDev 10.1.3 - Steps
    1. created a ADF VO w/ one bind variable vNAME.
    2. Created a basic jspx page, use the data control pal. to drop in VO w/ executeparam option. Use the data control pal to drop in VO w/ ADF Read-Only Table w/ select and sort option. Selected all VO columns in table.
    3. Following Error msg occurs when running jspx page -
    oracle.jbo.DMLException: Error while getting estimated row count for view object CategoryView, statement SELECT count(1) FROM (SELECT
    CATEGORY.CATID CATID,
    CATEGORY.NAME NAME,
    CATEGORY.PICTURE PICTURE,
    CATEGORY.ACTIVE ACTIVE
    FROM
    CATEGORY
    WHERE
    (CATEGORY.NAME LIKE UPPER(:vName)||'%')) .
    Tested SQL Statement in SQL Worksheet works ok (with a Value replacing ':vName').
    Can anyone advise - seems to be a straight forward process that is returning this error msg. I have tried variations of the SQL stmt with no luck. The jspx page errors when the ADF Read-Only Table is added.

    I seem 2 have the same error, in a slightly different situation.
    I have a view which subclasses a Entity with a history column 'CreatedOn'. When performing a quick search/filter on this column I get the same error. The ADF app is build on a DB2 database, so no named parameters here. Instead invalid SQL is created when executing the estimated row count. The WHERE clause contains 'CreatedOn = null', should be 'CreatedOn is null'. Furthermore the input of my quick search is not filled in this clause.
    Any help would be appreciated

  • I had folders for some mails , suddenly they disappeared in mail, but

    i had folders for some mails, suddenly they disappeared in mail. but theyre still in mobileme. How do i get them again.
    Also, i can[t delete emails from mail in my mac. just from that account that i had folders.
    help

    Testing

  • I'm unable to open up Lightroom 5, I get this message in a pop up box: "Lightroom encountered an error when reading from it's preview cache and needs to quit" Underneath  that is "Lightroom will attempt to fix this problem the next time when it launches."

    I'm unable to open up Lightroom 5, I get this message in a pop up box: "Lightroom encountered an error when reading from it's preview cache and needs to quit" Underneath  that is "Lightroom will attempt to fix this problem the next time when it launches."  It hasn't, what should I do? Thanks Shawn (Irish Se7en) .

    Can you try to rename (not delete!) the folder named "YOUR_CATALOG_NAME Previews.lrdata" and restart Lightroom?

  • I get two message threads for one contact. One for sms and one for iMessage since I updated to iOS 7. How can I get them both into one thread?

    Ever since I upgraded to iOS7 just two of my contacts I get two message threads for them. One containing their iMessages to me and the other with just regular sms messages. In Contacs, their email and phone number are saved under one name. How can I get the iMessages and sms to come through under one thread in my messaging app again?

    I am having this trouble also, my partner creates a new message to send to me, or sends a picture and it always comes through as an MMS and not using iMessage ...
    will try deleting everything and starting again!

  • How can I delete the 50 old email messages in the "ALL MAIL" box of my iphone 4s

    How can I delete all of the 50 old messages in the "ALL MAIL" Box of my iphone 4s?

    Blueyonder got bought out by Virgin Media didn't they, in which case they now use a Google server?
    You should be able to log on using the web and delete everything from there:
    mail.blueyonder.co.uk

  • Why  will photoshop not open after loading it to new iMac computer from an external hard drive and I get this message: Licensing for this product has stopped working:error code: 150:30

    Why will Photoshop CS4 not open after loading to new iMac from an external hard drive and I get this message: Licensing for this product has stopped working:error code: 150:30

    A Photoshop installation is tied to the machine it was installed on. Moving it to or from a hard drive breaks the licensing.
    The answer is easy: Reinstall CS4 from your disc. and apply all updates.
    Gene

Maybe you are looking for