I'm trying to execute the script located below, but I'm getting the error:

System.Management.Automation.PSArgumentException: Constructor not found. Cannot find an appropriate constructor for type Mi crosoft.SharePoint.Client.ClientContext. at System.Management.Automation.MshCommandRuntime.ThrowTerminatingError(ErrorRecord errorRecord)

The script is located here: https://gallery.technet.microsoft.com/office/How-to-add-users-to-1d3e69f9

I have both assemblies on the folder where the script is located at:

Microsoft.SharePoint.Client and Microsoft.SharePoint.Client.Runtime

Could you please guys help?


Make sure you are loading the assemblies directly, and have the latest version installed.

Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll"
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"

If you do not have these you will need to install them from Microsoft.


  • I have.. but still getting the same error... I can execute other scripts using csom.. the problem is not related with assemblies – Peter Smp May 31 '17 at 12:33
  • Can you post the full stack trace? It should be contained in the $error variable, and you can pull it by going $Error[0].StackTrace. – Taylor May 31 '17 at 12:35
  • @PeterSmp -- I would also check you have the latest CSOM assemblies available. It may be looking for something that is not in an older release. – Taylor May 31 '17 at 13:04
  • Glad to hear. Don't forget to answer your own question with the solution if mine didn't fix it. – Taylor May 31 '17 at 14:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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