[p4] Programming with PowerShell
Philip Kania
philip.kania at exemplics.com
Wed Aug 6 08:57:09 PDT 2008
You can use a function like:
function RecordSetToObject ($recordSet) {
$o = New-Object System.Management.Automation.PSObject
foreach ($key in $record.Fields.Keys) {
$n = New-Object System.Management.Automation.PSNoteProperty
$key,$record[$key]
$o.psobject.members.add($n)
}
$o
}
Then use:
$r.Records | %{ RecordSetToObject($_) }
Philip Kania
-----Original Message-----
From: perforce-user-bounces at perforce.com
[mailto:perforce-user-bounces at perforce.com] On Behalf Of Avi Levin
Sent: Tuesday, August 05, 2008 5:38 PM
To: perforce-user at perforce.com
Subject: [p4] Programming with PowerShell
Thanks a lot! P4.NET is fantastic.
I'm trying to make a collection of objects with the description of
"Product A". When I run
$r = $p4.Run("changes", "-L", "-s", "pending") , I get a P4Record Set.
Can I convert that straight into an object where the fields are
properties for the object, like
change desc
12345 Product A
12346 Product B
Which I could run | while on more easily?
Thanks,
Avi Levin
_______________________________________________
perforce-user mailing list - perforce-user at perforce.com
http://maillist.perforce.com/mailman/listinfo/perforce-user
More information about the perforce-user
mailing list