Ries
Ries

Reputation: 2866

Generics in PowerShell

I need to use the SharePoint API in the following way in a PowerShell script:

C# Code:

var service = farm.Services.GetValue<SPWebService>();

How does one specify the generics parameter in PowerShell?

At the moment I get an Exception stating that "Late bound operations cannot be performed on types or methods for which ContainsGenereicParameters is true"

Upvotes: 4

Views: 1292

Answers (1)

Mark Seemann
Mark Seemann

Reputation: 233150

This is not something you can easily do. You will have to resort to Reflection to make that work. See this blog post for more information.

Upvotes: 7

Related Questions