We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Different attachment count between .msg and mail in pst file

  • 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.

Hi Chenyang,


Thank you for considering Aspose.Email API.

It seems you are facing the evaluation limitations imposed by the API when used without a license that include:
  1. Only 50 emails can be extracted from a folder in PST file
  2. Only 3 attachments as well as inline images can be extracted from an MSG file
You can try the API without any evaluation limitations by requesting a 30-day temporary license fee of cost. Please let us know your feedback if you face any further issues in this regard.