Exchange.ListMessage( client.GetMailboxInfo().InboxUri ); returns 0 messages

Connecting to my own inbox and I see lots of messages, why does this return 0 messages? Is there another setting that I am missing?

ExchangeWebServiceClient client = new ExchangeWebServiceClient(“http://exhancge-ws/ews/Exchange.asmx”, “user”, “password”,“domain”);

ExchangeFolderInfoCollection folders = client.ListSubFolders(client.GetMailboxInfo().InboxUri);
// Call ListMessages method to list messages info from Inbox
ExchangeMessageInfoCollection msgCollection = client.ListMessages(client.GetMailboxInfo().InboxUri);

Thanks,

Hi,

Thank you for inquiry.

Could you please use the alternate approach below:

ExchangeMailboxInfo mailboxInfo = client.GetMailboxInfo();NetworkCredential credential = new NetworkCredential(username, password, domain);
ExchangeWebServiceClient client = new ExchangeWebServiceClient(mailboxURI, username, password, domain);

string rootUri = mailboxInfo.RootUri;
// List all the folders from Exchange server
ExchangeFolderInfoCollection folderInfoCollection = client.ListSubFolders(rootUri);
foreach (ExchangeFolderInfo folderInfo in folderInfoCollection)
{
// Call the recursive method to read messages and get sub-folders
if (folderInfo.DisplayName == “Inbox”)
{ /* list messages here */}
Console.WriteLine("Folder Name: " + folderInfo.DisplayName + ", Message count: " + folderInfo.TotalCount);
}