Can't Read/Retrieve mail items as per the count property of the folder

When i tries to retrieve the mails from an ost file folders it does not retrieve the mail items as per the count property of the folder. Here is some sample code:

private void ShowContent(FolderInfo folderInfo, string folderName)
{
this.folderName = folderName;
Search(folderInfo);
mailList.Items.Clear();
this.contentCount = this.folder.ContentCount;
this.unreadCount = this.folder.ContentUnreadCount;
this.folderUpdationDate = this.folder.LastModificationTime.ToString();
foreach (var messageInfo in this.folder.GetContents())
{
mailList.Items.Add(BuildList(messageInfo));
}
if(this.folder.HasSubFolders)
{
foreach(var subFolderInfo in this.folder.GetSubFolders())
{
foreach (var messageInfo in subFolderInfo.GetContents())
{
mailList.Items.Add(BuildList(messageInfo));
}
}
}
}

Hi Ravi,


Thank you for posting your inquiry.

We have tested this issue at our end using the latest version of the API at our end and with a sample OST/PST file. The counts returned are fine and no items are missing. Please share your sample OST file with us so that we can investigate the issue and assist you further.

Can you please give me the code that you used to retrieve the emails from an ost file.

Hi Ravi,

We have used the sample code available in our documentation article: Extract Messages from Outlook PST file, that is applicable to OST files as well. Your code is similar to this one and we suspect that the issue might be with reading messages information from your specific OST file. Please check it against your code sample and if the issue sill persists, please share your sample OST file with us for further investigation at our end.