Unable to search content of PST in outlook

Hi,

I am not sure if this is the right forum to ask. We have created a PST using Aspose Library of multiple emails having different language characters (both the emails and the PST are created using Aspose). After we load the PST into Outlook, and search for foreign characters. We are not getting those emails as search results. The content is being displayed correctly, just that we are not able to search.

Can you guide us in what can be the problem ? What details you need from us that will be helpful ?

We are sure that the emails got indexed as we are able to search content in other emails that are newer than these.

@abhiroyg,

I have observed the issue shared by you and request you to please try our latest Aspose.Email for .NET 20.3 for creating PST. If there is still an issue then please share the working sample code, generated PST and image highlighting the issue. We will try our best to help you further in this regard.

I am sorry I forgot to mention that this is for Java. Sure I will try and post the details you asked for.

@abhiroyg,

Sure, please share with us if you still encounter issues.

Hi @mudassir.fayyaz ,

We are facing the same issue with Aspose 20.3 too. We are working on creating a sample you can use to reproduce the same. In the mean time, would it be possible to show us a direction where we can look to tackle this issue ? Any guidelines ?

@abhiroyg,

We have recently launched Aspose.Email for .NET 20.4 and suggest you to try the same on your end. When you will provide the previously requested information, we will be able to carry out investigation further on our end on the basis of that and help you out.

Hi @mudassir.fayyaz, attaching the zip file with sample code, sample input html, generated PST file from the sample input html and images highlighting the issue as you had requested.

Before trying to run the code please include “aspose-email-20.4-jdk16.jar” in the lib folder as I had to remove it because of upload size limit on this ticketing system.

Our application runs on a Linux system.

To compile the code on a linux system:
Go to project’s directory and run following command:
“javac -classpath lib/*: SamplePstGeneration.java”

To run the code after compiling on a linux system:
Go to project’s directory and run following command:
"java -classpath lib/*: SamplePstGeneration "

The output PST will be generated in the same location as that of the input html file.

Please let me know if you have any queries or if you face any issues with the sample code.Aspose.zip (942.1 KB)

FYI: @abhiroyg

@himanshutambi,

Thank you for sharing the requested information with us. An issue with ID EMAILJAVA-34694 has been created in our issue tracking system as investigation to further investigate the issue. This thread has been linked with the issue so that you may be notified once the issue will be fixed.

Hi @mudassir.fayyaz, just checking if you have any updates on this issue. Also, can you please let me know the ETA for this?

@himanshutambi,

We have investigated the issue on our end. Actually, the aspose.html file contains UTF-8 encoded body but meta charset defined as koi8-r

We need to change charset to UTF-8 and Outlook search will be work as expected

@mudassir.fayyaz: We don’t have control over the input data. The data is coming from customer and the actual origin of data is from Email Exchange server.

We have other PST files containing emails with different charset (non UTF-8) which are not generated using Aspose, the search works fine in Outlook. Attaching a sample PST file here.

All_Languages_From_Outlook_Smaller_Set.zip (53.9 KB)

That’s why we want to understand what is special with Aspose library while generating PST.

@himanshutambi,

I have associated the information in our issue tracking system and will share feedback with you as soon as it will be shared.

Hi @mudassir.fayyaz, just checking if you have any updates on the issue.

@himanshutambi,

Can you please confirm that if you have taken this issue up in priority support helpdesk too?

Yes @mudassir.fayyaz, we have taken this issue up on priority support helpdesk.

@himanshutambi,

We can propose you to please use fmethod to set html body content.

Instead of msg.setProperty, we can use msg.setBodyContent with BodyContentType.Html.
In this case we have no encoding issues and Outlook search works correctly.

private static void addBody(MapiMessage msg, String inputFile) throws IOException {

    Long codePageValue = new Long(65001);
    MapiProperty cpid = new MapiProperty(MapiPropertyTag.PR_INTERNET_CPID, convertLong2ByteArray(codePageValue));
    msg.setProperty(cpid);

    //byte[] data = convertHtmlBodyToArray(inputFile);
    //MapiProperty mProp = new MapiProperty(MapiPropertyTag.PR_HTML, data);     
    //msg.setProperty(mProp);
    msg.setBodyContent(convertHtmlBodyToString(inputFile), BodyContentType.Html);
}

private static String convertHtmlBodyToString(String inputFile) throws IOException {

    InputStream is;
    if(inputFile == null)
        is = SamplePstGeneration.class.getResourceAsStream(inputFileInResource);
    else
        is = new FileInputStream(inputFile);
    String text = new String(IOUtils.toByteArray(is));
    if(text.startsWith("<")) {
        text = StringEscapeUtils.unescapeXml(text);
    }

    return text;
}

@mudassir.fayyaz: Thanks for the suggestion, we will try it and revert.

@himanshutambi,

You are always welcome.

@mudassir.fayyaz: I tried out your suggestion but then I ran into another issue where plain text email messages were getting generated instead of HTML. Because of this all formatting and styling of these messages is gone. Can you please take a look and help us out with this?

@himanshutambi,

Please share the used sample code, source file and generated output with us along with expected output. We will investigate that further to help you out.