Skip to content
This repository has been archived by the owner on Aug 24, 2021. It is now read-only.

Method not found running Add-PnPMicrosoft365GroupMember #1951

Closed
mikeparkie opened this issue Jun 18, 2021 · 3 comments
Closed

Method not found running Add-PnPMicrosoft365GroupMember #1951

mikeparkie opened this issue Jun 18, 2021 · 3 comments

Comments

@mikeparkie
Copy link

mikeparkie commented Jun 18, 2021

Category: Bug [✔]
Environment: Office 365 / SharePoint Online [✔]
Connecting from Windows Server 2008 R2
PnP.PowerShell 1.6.0 [PowerShell Gallery with Install-Module]
Microsoft.Online.SharePoint.PowerShell 16.0.21213.12000 [PowerShell Gallery with Install-Module]

As part of our site provisioning script we add new site admins to our site admins Yammer group using:
Add-PnPMicrosoft365GroupMember -Identity "sitename" -Users "user.name@company.domain"

This runs fine on several of our machines, other than one where it produces the following error:

Add-PnPMicrosoft365GroupMember : Method not found: 'System.Net.Http.HttpClient PnP.Framework.Http.PnPHttpClient.GetHttpClient()'.
At line:1 char:1
+ Add-PnPMicrosoft365GroupMember -Identity "sitename" - ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Add-PnPMicrosoft365GroupMember], MissingMethodException
    + FullyQualifiedErrorId : System.MissingMethodException,PnP.PowerShell.Commands.Microsoft365Groups.AddMicrosoft365GroupMember

Reading this #1741 I attempted the following steps:

Deleted all the SharePoint Components from the Control Panel (Add/Remove)
Removed all SharePoint items from (C:\windows\Microsoft.NET\assembly\GAC_MSIL),
Uninstalled both PS modules and reinstalled again
Restarted the machine

Retried original command and it's still producing the same error.

Any ideas appreciated, TIA

@tonylanglet
Copy link

tonylanglet commented Jun 22, 2021

I had a similar problem to the issue you linked to, where I got told that the Method that was being called didn't exists. I did some diging and found out that the server that I ran the script from (Connect-PnPOnline) did not have .NET Core installed on it.

I installed .NET Core 3.1 Runetime and it seemed to solve the issue as the Methods I required were located in the .NET Core.

@mikeparkie
Copy link
Author

Thanks for the suggestion @tonylanglet I gave that a go, rebooted the server and rerun the commands. Same errors. Alas the digging continues.

@mikeparkie
Copy link
Author

We found that two of our severs were missing .Net 4.8. Updated both/rebooted and commands now complete correctly 👍😎. Closing the issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants