Unable to create new object in powershell

Hello

i am not a hardcore developer by trade but have been asked to provide a solution for which i have downloaded the latest aspose.email library
I am using powershell on windows 11 to load the dll and then trying to create a new pst object to load a pst file however its giving an error for which i am not able to find a lot of info on google

Please advice

PS C:\Users\varun> [System.Reflection.Assembly]::LoadFrom(“C:\Program Files (x86)\Aspose\Aspose.Email for .NET\Bin\net4.0\Aspose.Email.dll”)

GAC Version Location


False v4.0.30319 C:\Program Files (x86)\Aspose\Aspose.Email for .NET\Bin\net4.0\Aspose.Email.dll

PS C:\Users\varun> new-object Aspose.Email.Storage.Pst
new-object : Cannot find type [Aspose.Email.Storage.Pst]: verify that the assembly containing this type is loaded.
At line:1 char:1

  • new-object Aspose.Email.Storage.Pst
  •   + CategoryInfo          : InvalidType: (:) [New-Object], PSArgumentException
      + FullyQualifiedErrorId : TypeNotFound,Microsoft.PowerShell.Commands.NewObjectCommand

Hello @varunagg,

Let me make a little clarification: Aspose.Email.Storage.Pst isn’t a type, but a namespace. Use Aspose.Email.Storage.Pst.PersonalStorage class to load the object.

It should work.