18 January 2016

How to load a dot net class in Powershell when you don't know the DLL name.

Most of us know that the main SharePoint classes live in Microsoft.SharePoint.dll.  The easiest way to load this assembly is by using the ::LoadWithPartialName method thus releasing you from having to use the exact DLL name.  In this case its obvious, but there are a couple of classes that are in DLLs that are not so obvious.  Simply call the following:

[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint");

You can replace the "Microsoft.SharePoint" with any class name, provided its accessible on the system.

Enjoy
C

No comments:

Post a Comment

Comments are moderated only for the purpose of keeping pesky spammers at bay.

SharePoint Remote Event Receivers are DEAD!!!

 Well, the time has finally come.  It was evident when Microsoft started pushing everyone to WebHooks, but this FAQ and related announcement...