Powershell initialization

Hi,

I wondering how can i use this product with Powershell.

For example i try to read pst file information:



PS C:> [System.Reflection.Assembly]::LoadFrom(".\Aspose\net4.0\Aspose.Email.dll")

Component is loaded, and i can create object

PS C:> New-Object Aspose.Email.Outlook.Pst.PersonalStorage





RootFolder :

DisplayName :

Format :

CanWrite :

MessageStoreProperties :

IsUnicode :



But i can’t load pst:

PS C:> New-Object Aspose.Email.Outlook.Pst.PersonalStorage.FromFile(“E:\archive.pst”)

New-Object : Cannot find type [Aspose.Email.Outlook.Pst.PersonalStorage.FromFile]: make sure the assembly containing this type is loaded.



PS C:> New-Object Aspose.Email.Outlook.Pst.PersonalStorage | gm





TypeName: Aspose.Email.Outlook.Pst.PersonalStorage



Name MemberType Definition

---- ---------- ----------

ChangeDisplayName Method System.Void ChangeDisplayName(string newName)

CreatePredefinedFolder Method Aspose.Email.Outlook.Pst.FolderInfo CreatePredefinedFolder(string name, Aspose.Ema…

Dispose Method System.Void Dispose()

Equals Method bool Equals(System.Object obj)

ExtractMessage Method Aspose.Email.Outlook.MapiMessage ExtractMessage(Aspose.Email.Outlook.Pst.MessageIn…

ExtractProperty Method Aspose.Email.Outlook.MapiProperty ExtractProperty(byte[] entryId, long tag)

GetFolderById Method Aspose.Email.Outlook.Pst.FolderInfo GetFolderById(byte[] entryId), Aspose.Email.Ou…

GetHashCode Method int GetHashCode()

GetPredefinedFolder Method Aspose.Email.Outlook.Pst.FolderInfo GetPredefinedFolder(Aspose.Email.Outlook.Pst.S…

GetType Method type GetType()

ToString Method string ToString()

CanWrite Property System.Boolean CanWrite {get;}

DisplayName Property System.String DisplayName {get;}

Format Property Aspose.Email.Outlook.Pst.FileFormat Format {get;}

IsUnicode Property System.Boolean IsUnicode {get;}

MessageStoreProperties Property Aspose.Email.Outlook.MapiPropertyCollection MessageStoreProperties {get;}

RootFolder Property Aspose.Email.Outlook.Pst.FolderInfo RootFolder {get;}



I’ve tried to register dll with regasm, and load it as COM object

PS C:> New-Object -ComObject Aspose.Email.Outlook.Pst.PersonalStorage.FromFile(“E:\archive.pst”)

but with the same results.

What is the right way to use this component from Powershell?

(Server 2008R2 x64)

Problem solved, thanks to all)
It’s need to use such command to execute methods declared as static
[Aspose.Email.Outlook.Pst.PersonalStorage]::fromfile($pst, $false)

Hi Sepa,


Its good to know you have got solution to the issue and thanks for sharing it here, as it will benefit other forum users as well. If you have any additional query, please feel free to contact us. We will try to assist you as soon as possible.