I am writing a C # Windows Form application to transfer Exchange 2010 mailboxes to a file location on a server in PST format. I used the example from the Powershell SDK (Runspace05) to access the Exchange cmdlets (Get-Mailbox) and filled the combo box with user mailboxes without any problems.
I am having problems getting the New-MailboxExportRequest cmdlet (the export cmdlet) and the ability to return its objects and display them in a list control. What am I missing? Thanks in advance for your help.
The code:
InitialSessionState iss = InitialSessionState.CreateDefault(); PSSnapInException warning; iss.ImportPSSnapIn("Microsoft.Exchange.Management.PowerShell.E2010", out warning); using (Runspace myrunspace = RunspaceFactory.CreateRunspace(iss)) { myrunspace.Open(); using (PowerShell powershell = PowerShell.Create()) { var mailbox = cmbEmailUserName.Text; var pstFile = txtFileSaveLocation.Text; const int badLimit = 100;
source share