0

We're looking to use a static function from a C# class we've written in a Powershell Extensions script.

We have included our code as a dll in the bin directory of our Sitecore application, and have verified that the code is available to the application.

We can successfully run something like the following line from SPE:

[Sitecore.DateUtil] | Get-Member -Static

When we run the same command with the namespace/class that we've written, the error is this:

Unable to find type [Namespace.Class].
At line:1 char:1
+ [Namespace.Class] | Get-Member
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (Namespace.Class:TypeName) [], RuntimeException
    + FullyQualifiedErrorId : TypeNotFound

Is there a prerequisite set of steps in order to make a class or static method available to SPE?

0

Whoops -- double check that the class and method you are trying to access are public.

In this case, the class was not public.

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.