Hey folks,

 

I'm trying to use the Azure .NET SDK from PowerShell, to write some wrapper
functions. The steps I'm following are:

 

1.       Get a CloudMediaContext

2.       Create an Azure Media Services Job (IJob interface)

3.       Add an ITask to the TaskCollection on the IJob

 

On step #3, the IJob.Tasks property is supposed to return a TaskCollection,
which declares the AddNew() method that I need. However, PowerShell is
instead seeing interpreting the IJob.Tasks property as a List`1[TaskData].
This ultimately means that I lose access to the AddNew() method on the
TaskCollection class, which I need to call, per the documentation for Azure
Media Services <http://msdn.microsoft.com/en-us/library/dn282273.aspx> .

 

On top of that, the TaskData class (in Azure Media Services) is marked as
internal, so I cannot directly instantiate it, and then cast it as an ITask.
If I could do that, I might be able to call List`1[TaskData].Add() instead
of using the TaskCollection.AddNew() method, but I can't.

 

Any ideas on how to work around this PowerShell oddity?

 

Here's a screenshot of how Visual Studio / C# are properly interpreting the
IJob.Tasks property as a TaskCollection.

 



 

And here is the evidence of PowerShell exposing TaskCollection as the ugly
generic: List`1[TaskData].

 



 

I've even tried casting the generic list to a TaskCollection, but that type
conversion isn't supported without the LINQ extension method Cast<T>.

 



 

Cheers,

Trevor Sullivan

Microsoft PowerShell MVP



Reply via email to