Created
January 5, 2015 08:13
-
-
Save vgrem/34d0e65b0732a1b368ce to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function Invoke-LoadMethodV2() { | |
param( | |
$Context = $(throw "Please provide an Client Context"), | |
$Object = $(throw "Please provide an Client Object instance on which to invoke the generic method") | |
) | |
$load = [Microsoft.SharePoint.Client.ClientContext].GetMethod("Load") | |
$type = $Object.GetType() | |
$clientObjectLoad = $load.MakeGenericMethod($type) | |
$clientObjectLoad.Invoke($Context,@($Object,$null)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment