The following PowerShell code to publish an array of pages fails, because the arguments or parameters are in the wrong format.
$client.publish($toPublish, $publishInstruction, @($targetId), $null, $readOptions);
$toPublish is an array with tcm id's, and $toPublish.getType() return Object.
$publishInstruction is a reference to the PublishInstructionData class and $publishInstruction.getType() returns the same class.
$targetId is a string with the target type.
$readOptions is a reference to the ReadOptions class.
The publishing priority is now set to null, but also set to "Publish".
PowerShell returns error message:
Cannot find an overload for "Publish" and the argument count: "5". $client.publish <<<< ($toPublish, $publishInstruction, @($targetId), $null, $readOptions); + CategoryInfo : NotSpecified: (:) , MethodException + FullyQualifiedErrorId : MethodCountCouldNotFindBest
I guess that the enum for the priority is the culprit, since the other params are of the correct type.
So what the correct syntax for publishing an array of pages using the PowerShell language? (haven't found no working example using Google).
2011 SP1 API Reference Guide.CHM:
IEnumerable<PublishTransactionData> Publish( IEnumerable<string> ids, PublishInstructionData publishInstruction, IEnumerable<string> targets, Nullable<PublishPriority> priority, ReadOptions readOptions )