Unable to read Email file using Aspose in SP Online (C# .NET)

I am working on migrating a Remote Event Receiver from SP 2013 to SP Online.
Upon adding an item(outlook mail item) in my library, i need to read the contents of file.

Current Code(in On Prem) -
var fileInformation = Microsoft.SharePoint.Client.File.OpenBinaryDirect(clientContext, fileURLofdocset); //getting review document pdf file

        // Read received email using Aspose email dll            
        using (var memory = new MemoryStream())
        {
            string emailFrom = string.Empty;

            byte[] buffer = new byte[1024 * 64];
            int nread = 0;
            while ((nread = fileInformation.Stream.Read(buffer, 0, buffer.Length)) > 0)
            {
                memory.Write(buffer, 0, nread);
            }
            memory.Seek(0, SeekOrigin.Begin);

            message = Aspose.Email.Mail.MailMessage.Load(memory);                 
        }

Code modified by me for SP Online -
var file = clientContext.Web.GetFileByServerRelativeUrl(fileURLofdocset);
clientContext.Load(file);
clientContext.ExecuteQuery();
ClientResult streamResult = file.OpenBinaryStream();
clientContext.ExecuteQuery();

        Helper.LogInfo("ESSATRemoteEventReceiver->ESSATEmails->GetMailSubject-> streamResult.Value", streamResult.Value.ToString(), clientContext);

        using (var memory = new MemoryStream())
        {               
            streamResult.Value.CopyTo(memory);
            message = Aspose.Email.Mail.MailMessage.Load(memory);
        }

Above code changes doesnt work. Neither does it give any exception/error.
Any suggested are welcome.

@skelkar,

I have observed your requirements and sample code. Actually, from Aspose.Email perspective we need to verify if the Message file is being accessed using latest Aspose.Email for .NET 19.4 or not. If there is any issue incurred we may log that in our issue tracking system. I request you to please share the message file that is hosted in SharePoint on your end and see if that gets loaded using Aspose.Email or not.

image.png (6.1 KB)

@skelkar,

I have observed the version information image shared by you. As suggested earlier, please try using latest Aspose.Email for .NET 19.4 on your end. If there is any issue incurred please share the message file that is hosted in SharePoint on your end as we need to see if that gets loaded using Aspose.Email or not.

Hi, I have installed the latest package of Aspose Email for .Net 19.4 but still facing the below issue -

Failed to set license. Details: The subscription included in this license allows free upgrades until 01 Jul 2016, but this version of the product was released on 27 Apr 2019. Please renew the subscription or use a previous version of the product.

Please suggest.

@skelkar,

The message information share that your license is old and is not valid for latest available version in which the issue has been marked as resolved. I request you to please renew your subscription to avail latest version on your end.