- i got different attachment count between the mail in pst file and msg file.
Pst:
PersonalStorage pst = PersonalStorage.FromFile(pstpath);
FolderInfo folderinfo = pst.RootFolder.GetSubFolder("Inbox");
int totalcount = folderinfo.ContentCount;
int count = (int)Math.Ceiling((double)totalcount / 50);
Console.WriteLine("Count:"+totalcount);
MapiMessage msg = null;
// bool b = false;
for (int index = 0, i = 0; i < count; i++)
{
index = i * 50;
MessageInfoCollection messageInfoCollection = folderinfo.GetContents(index, 50);// max 50
foreach (MessageInfo messageInfo in messageInfoCollection)
{
try
{
msg = pst.ExtractMessage(messageInfo);
int i = msg.Attachments.Count;
msg.Dispose();
}
catch (Exception ex)
{
throw ex;
}
}
}
Msg:
foreach (FileInfo f in msgfiles)
{
try
{
msg = MapiMessage.FromFile(f.FullName);
int i = msg.Attachments.Count;
}
}
catch (Exception ex)
{
TestLog.LogException(ex.Message);
}
}
- How can i increase the folderinfo.GetContents() i found the max is 50. May be the same thing with the attachment count thing.. Only 3 attachments can be got in pst ?
attached is the pst file and msg file.