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

Free Support Forum - aspose.com

Unable to cast object of type '?.?' to type '?.'

<div>Aspose.Email for .NET 4.0</div>
<div>Version 3.5.0.0</div>
<div>
	<br>
</div>
When calling the following method on the Aspose.Email.Outlook.Pst.FolderInfo object:<div>
	<br>
</div>
<div><b>AddMessage(MapiMessage message)</b></div>
<div>
	<br>
</div>
<div>I occasionally receive the following error:</div>
<div>
	<br>
</div>
<div><b>Unable to cast object of type '’.' to type '’.'</b></div>
<div>
	<br>
</div>
<div>That is how it "pastes" here. When viewed in SublimeText2 it looks like this:</div>
<div>
	<br>
	<img src="http://www.mavyak.com/images/MailConverterException.JPG" alt="http://www.mavyak.com/images/MailConverterException.JPG"></div>
<div>
	<br>
</div>
<div>This is the SafeFolder class referenced above:</div>

<div>
	<br>
</div>
<div style="background-color: lightyellow;">

public class SafeFolder

{

SafePst parent;

FolderInfo unsafeFolder;



public SafeFolder(SafePst parent, FolderInfo unsafeFolder)

{

this.parent = parent;

this.unsafeFolder = unsafeFolder;

}



public void AddMessage(MapiMessage message)

{

lock (parent)

{

unsafeFolder.AddMessage(message);

}

}

}







	<div>Is there enough information here to tell me what it's trying to cast to what (and maybe why it can't perform the cast)?</div>
	<div>
		<br>
	</div>
	<div>Please advise.</div>
	<div>
		<br>
	</div>

Hi Jason,


Thank you for posting your inquiry.

We have noticed that you are using an older version of Aspose.Email API. Please download the latest version of Aspose.Email for .NET 5.7.0 and test the issue using this latest version. If the problem still exists, please share your sample MSG files with us for investigation at our end. We shall look into it and assist you further.