交換コマンドレットを実行する次のコードがありますが、結果が返されると、次のような値が返されます。
Microsoft.Exchange.Management.RecipientTasks.MailboxAcePresentationObject
オブジェクト自体ではなく、このオブジェクトのテキスト値を取得するにはどうすればよいですか?
これは、値を取得するために使用しているコードです。
powershell.Runspace = runspace;
powershell = PowerShell.Create();
PSCommand command = new PSCommand();
command.AddCommand("Get-MailboxPermission");
command.AddParameter("Identity", "myname");
powershell.Commands = command;
powershell.Runspace = runspace;
Collection<PSObject> result = powershell.Invoke();
StringBuilder sb = new StringBuilder();
foreach (PSObject ps in result)
{
sb.AppendLine(ps.ToString());
}
sb.AppendLine();
lbl.Text += sb.ToString();