Einzelnen Beitrag anzeigen

Benutzerbild von Remko
Remko

Registriert seit: 10. Okt 2006
Ort: 's-Hertogenbosch, Die Niederlande
222 Beiträge
 
RAD-Studio 2010 Arc
 
#1

powershell cmdlet (delphi.net)

  Alt 29. Feb 2008, 18:21
I am trying to convert this sample code in C# (creates a mailbox in Exchange 2007) to Delphi.net (RAD Studio 2007).

I installed PowerShell and made a reference to the System.Management.Automation.dll. On this code:
Delphi-Quellcode:
uses
  ...
  system.IO,
  system.Collections.Generic,
  system.Management.Automation,
  system.Management.Automation.Host,
  system.Management.Automation.Runspaces;
  ...

var
  rc: RunspaceConfiguration;
  snapEx: PSSnapInException;
  info: PSSnapInInfo;
  myRunSpace: Runspace;
  pl: PipeLine;
  newMbx: Command;
begin
  snapEx := nil;
  rc := RunSpaceConfiguration.Create;
  info := rc.AddPSSnapIn('Microsoft.Exchange.Management.PowerShell.Admin', snapEx);
  MyRunSpace := RunspaceFactory.CreateRunspace(rc);
  MyRunSpace.Open;
  pl := MyRunSpace.CreatePipeline;
I get error [DCC Error] uMain.pas(41): E2003 Undeclared identifier: 'Create' on the line rc := RunSpaceConfiguration.Create;
According to MSDN the RunSpaceConfiguration class is abstract that might have something to do with it, but in all examples (VB and C#) it is used like this.

Maybe this is just .net being new to me... but any help/suggestions is welcome.
  Mit Zitat antworten Zitat