Hello,
I need a help for creating the correct MailQueryBuilder structure.
I have the following piece of code:
MessageInfoCollection col;
col = pstFolder.getContents(50, 100);
I also need to add descending order, which I’ve found to do it in this way:
MailQueryBuilder query = new MailQueryBuilder();
query.getInternalData().orderBy(false); // descending
The problem is that getContents() does not support 50, 100 and query.getQuery() arguments.
How can I do to make this query works?
Thanks
@kelberuc1 ,
Could you please describe more details about the issue?
Note: If you are using the trial version of Aspose.Email, only 50 emails can be extracted from the folder in a PST file. You should acquire a license for full use Aspose.Email. More details about limitations:
Class Libraries & REST APIs for the developers to manipulate & process Files from Word, Excel, PowerPoint, Visio, PDF, CAD & several other categories in Web, Desktop or Mobile apps. Develop & deploy on Windows, Linux, MacOS &...
HI @Andrey_Potapov ,
I have a valid license for Aspose.Email.Java.
I’m trying to run the following code but it’s not working for getting sorted messages:
MailQueryBuilder query = new MailQueryBuilder();
query.getInternalDate().orderBy(false); // sort the date descending
List<MessageInfo> messageInfoCollection;
if (options.msgQty > 0 && options.msgStartIndex > 0)
messageInfoCollection = pstFolder.getContents(query.getQuery()).getRange(options.msgStartIndex - 1, options.msgQty);
else
messageInfoCollection = pstFolder.getContents(query.getQuery());
for (int i = 0; i < messageInfoCollection.size(); i++)
{
MessageInfo messageInfo = (MessageInfo) messageInfoCollection.get(i);
// do something ...
}
What can I do to make it work?
@kelberuc1 ,
Unfortunately, I cannot use your code example to investigate the issue because it contains unknown variable options
. Could you please share a comprehensive code snippet?
@Andrey_Potapov ,
Let me rewrite the code using known variables for you:
MailQueryBuilder query = new MailQueryBuilder();
query.getInternalDate().orderBy(false); // sort the date descending
List<MessageInfo> messageInfoCollection;
messageInfoCollection = pstFolder.getContents(query.getQuery()).getRange(50, 100)
for (int i = 0; i < messageInfoCollection.size(); i++)
{
MessageInfo messageInfo = (MessageInfo) messageInfoCollection.get(i);
// do something ...
}
And now, is it possible to you to check?
@kelberuc1 ,
Thank you for the code example. I reproduced the issue and received the same problem. I have logged the issue in our tracking system with ID EMAILJAVA-34856 . Our development team will investigate it. You will be notified when it is fixed.
Hello,
I need a solution for this case in order to finish my end product…
How is it?
Thanks
@kelberuc1 ,
The solution for this issue has been planned to be released with Aspose.Email 21.4.