Closed
Description
I've just updated to Microsoft.Graph 0.5.0 and tried using Move-MgUserMessage from Microsoft.Graph.Users.Actions.
When run, I get a Method not found exception calling out System.Net.Http.HttpClient Microsoft.Graph.PowerShell.Authentication.Helpers.HttpHelpers.GetGraphHttpClient(Microsoft.Graph.PowerShell.Authentication.IAuthContext)
I have observed this with both Windows PowerShell 5.1 and PowerShell 7.1 Preview 2
I had previously been running 0.2.1 of the Microsoft.Graph module suite and ran Update-Module Microsoft.Graph to update.
Full (redacted) code
$Cert = 'THUMBPRINT'
$AppId = 'GUID'
$TenantId = 'GUID'
$User = 'user@example.com'
$TestingFolder = 'FolderID'
$UnknownFolder = 'FolderID'
Connect-Graph -CertificateThumbprint $Cert -ClientId $AppId -TenantId $TenantId
$Messages = Get-MgUserMailFolderMessage -UserId $User -MailFolderId $TestingFolder
$Messages.Count
foreach ($Mail in $Messages) {
Move-MgUserMessage -MessageId $Mail.Id -DestinationId $UnknownFolder
}
$Messages = Get-MgUserMailFolderMessage -UserId $User -MailFolderId $TestingFolder
$Messages.CountError
PS C:\Windows\System32> Get-Error
Exception :
Type : System.MissingMethodException
Message : Method not found: 'System.Net.Http.HttpClient
Microsoft.Graph.PowerShell.Authentication.Helpers.HttpHelpers.GetGraphHttpClient(Microsoft.Graph.PowerShell.Authentication.IAuthContext)'.
TargetSite :
Name : BeforeCreatePipeline
DeclaringType : Microsoft.Graph.PowerShell.Module, Microsoft.Graph.Users.Actions.private, Version=0.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
MemberType : Method
Module : Microsoft.Graph.Users.Actions.private.dll
StackTrace :
at Microsoft.Graph.PowerShell.Module.BeforeCreatePipeline(InvocationInfo invocationInfo, HttpPipeline& pipeline)
at Microsoft.Graph.PowerShell.Module.CreatePipeline(InvocationInfo invocationInfo, String parameterSetName)
at Microsoft.Graph.PowerShell.Cmdlets.MoveMgUserMessage_MoveExpanded.ProcessRecordAsync()
Source : Microsoft.Graph.Users.Actions.private
HResult : -2146233069
CategoryInfo : NotSpecified: (:) [Move-MgUserMessage_MoveExpanded], MissingMethodException
FullyQualifiedErrorId : Microsoft.Graph.PowerShell.Cmdlets.MoveMgUserMessage_MoveExpanded
InvocationInfo :
MyCommand : Move-MgUserMessage_MoveExpanded
ScriptLineNumber : 2
OffsetInLine : 5
HistoryId : 10
Line : Move-MgUserMessage -MessageId $Mail.Id -UserId $User -DestinationId $UnknownFolder
PositionMessage : At line:2 char:5
+ Move-MgUserMessage -MessageId $Mail.Id -UserId $User -Destination …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
InvocationName : Move-MgUserMessage
CommandOrigin : Internal
ScriptStackTrace : at Move-MgUserMessage<Process>, C:\Program Files\WindowsPowerShell\Modules\Microsoft.Graph.Users.Actions\0.5.0\exports\ProxyCmdletDefinitions.ps1: line 26239 at <ScriptBlock>, <No file>: line 2
PipelineIterationInfo :
Environment
Windows PowerShell 5.1
PS C:\Users\Windos> $PSVersionTable
Name Value
---- -----
PSVersion 5.1.18362.752
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.18362.752
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Script 1.0.0.0 ISE {Get-IseSnippet, Import-IseSnippet, New-IseSnippet}
Script 0.2.0 Microsoft.Graph.Authentication {Connect-Graph, Disconnect-Graph, Get-MgContext}
Script 0.5.0 Microsoft.Graph.Users.Actions {Clear-MgUserAndBlockManagedApp, Clear-MgUserManagedAppRegistration, Clear-MgUserManagedDevice, Clear-MgUserWindowInformationProtec...
Script 0.2.1 Microsoft.Graph.Users.Mail {Get-MgUserInferenceClassification, Get-MgUserInferenceClassificationOverride, Get-MgUserMailFolder, Get-MgUserMailFolderChildFolde...
Manifest 3.1.0.0 Microsoft.PowerShell.Management {Add-Computer, Add-Content, Checkpoint-Computer, Clear-Content...}
Manifest 3.0.0.0 Microsoft.PowerShell.Security {ConvertFrom-SecureString, ConvertTo-SecureString, Get-Acl, Get-AuthenticodeSignature...}
Manifest 3.1.0.0 Microsoft.PowerShell.Utility {Add-Member, Add-Type, Clear-Variable, Compare-Object...}
Manifest 3.0.0.0 Microsoft.WSMan.Management {Connect-WSMan, Disable-WSManCredSSP, Disconnect-WSMan, Enable-WSManCredSSP...}
PowerShell 7.1
PS C:\Windows\System32> $PSVersionTable
Name Value
---- -----
PSVersion 7.1.0-preview.2
PSEdition Core
GitCommitId 7.1.0-preview.2
OS Microsoft Windows 10.0.18363
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
PS C:\Windows\System32> Get-Module
ModuleType Version PreRelease Name ExportedCommands
---------- ------- ---------- ---- ----------------
Script 0.2.0 Microsoft.Graph.Authentication {Connect-Graph, Disconnect-Graph, Get-MgContext}
Script 0.5.0 Microsoft.Graph.Users.Actions {Clear-MgUserAndBlockManagedApp, Clear-MgUserManagedAppRegistration, Clear-MgUserManagedDevice, Clear-MgUserWindowInf…
Script 0.2.1 Microsoft.Graph.Users.Mail {Get-MgUserInferenceClassification, Get-MgUserInferenceClassificationOverride, Get-MgUserMailFolder, Get-MgUserMailFo… Manifest 7.0.0.0 Microsoft.PowerShell.Management {Add-Content, Clear-Content, Clear-Item, Clear-ItemProperty…}
Manifest 7.0.0.0 Microsoft.PowerShell.Utility {Add-Member, Add-Type, Clear-Variable, Compare-Object…}
Script 2.0.1 PSReadLine {Get-PSReadLineKeyHandler, Get-PSReadLineOption, Remove-PSReadLineKeyHandler, Set-PSReadLineKeyHandler…}
Metadata
Metadata
Assignees
Labels
No labels
Activity
Windos commentedon May 2, 2020
I believe this will be related to #165
When running
Update-Module Microsoft.Graphthe only thing being updated is the wrapper module and in addition any new modules are being installed (hence I got the Users.Actions one I was looking for). But because a minimum version isn't being specified, existing modules like Authentication and Users.Mail were left at whatever they were installed at (in the case of Authentication I'm still lagging back at 0.2.0!)In order to actually update all of the components, I'm having to now run
Update-Module Microsoft.Graph*but this means I need to consent to every single update... and there's a lot of them (it's already a slow install, this marks it really bad)Windos commentedon May 2, 2020
I know this is turning into a branching comedy of issues, but it's the path I'm taking trying to troubleshoot both for others having the same issues and hopefully it being better for others in the future.
I gave up on consenting to updating every individual package and deleted the currently installed version(s) of the module and install fresh.
It now gives me an error when running
Get-MgUserMailFolderMessage:I manually install that specific version of Microsoft.Graph.Authentication:
AND then manually import it:
.... 🤦♂️ same error as what I started with, just on a different cmdlet.
I guess this issue can be summed up with:
peombwa commentedon May 4, 2020
Hi Josh King (@Windos), thanks for the detailed repro steps.
The error you seeing is due to change that we made on how we store the access token in a users session. You need to update all modules to 0.5.0. Run
Update-Module Microsoft.Graph -Forceto update all modules plus their dependencies to 0.5.0.Windos commentedon May 7, 2020
Can confirm this issue is fixed with 0.5.1 (#206) - thanks teams (and Peter Ombwa (@peombwa))
JustinGrote commentedon Jul 8, 2021
Peter Ombwa (@peombwa) I got this error with Get-MgDirectorySetting, is it related or should I file a new issue?
Looks like the method signature is there to me...
peombwa commentedon Jul 8, 2021
Justin Grote (@JustinGrote) This is because you are using a deprecated module -
Microsoft.Graph,Identity.DirectorySettings 0.9.1. UseMicrosoft.Graph.Identity.DirectoryManagementv1.6.0 instead.As noted here #744, I'll update all 0.9.1 to warn customers that they are using a deprecated module.