msgraph-sdk-powershell icon indicating copy to clipboard operation
msgraph-sdk-powershell copied to clipboard

Get-MgUserPhotoContent: Cannot set percent because PercentComplete cannot be greater than 100. (Parameter 'value')

Open jpawlowski opened this issue 2 years ago • 0 comments

Describe the bug Most of the time, the command Get-MgUserPhotoContent does not seem to handle visual progress bar properly as the following error message is given:

Get-MgUserPhotoContent_Get: Cannot set percent because PercentComplete cannot be greater than 100. (Parameter 'value')
Actual value was 2147483647.

The error appears with production and beta MgGraph modules.

To Reproduce Steps to reproduce the behavior:

$TempFile = New-TemporaryFile
Get-MgUserPhotoContent -UserId [email protected] -OutFile $TempFile.FullName -WarningAction SilentlyContinue

Expected behavior The error message should not appear so that the command can be used without -ErrorAction SilentlyContinue and the script is not interrupted.

Debug Output

DEBUG: [CmdletException]: Received exception with message 'PSArgumentOutOfRangeException - Cannot set percent because PercentComplete cannot be greater than 100. (Parameter 'value')
Actual value was 2147483647. :    at System.Management.Automation.ProgressRecord.set_PercentComplete(Int32 value)
   at Microsoft.Graph.Beta.PowerShell.PSCmdletExtensions.GetProgress(ProgressRecord currentProgressRecord, Stream stream)
   at Microsoft.Graph.Beta.PowerShell.PSCmdletExtensions.WriteToStream(PSCmdlet cmdlet, Stream inputStream, Stream outputStream, String downloadUrl, CancellationToken cancellationToken)
   at Microsoft.Graph.Beta.PowerShell.PSCmdletExtensions.WriteToFile(PSCmdlet cmdlet, HttpResponseMessage response, Stream inputStream, String filePath, CancellationToken cancellationToken)
   at Microsoft.Graph.Beta.PowerShell.Cmdlets.GetMgBetaUserPhotoContent_Get.on2Xx(HttpResponseMessage responseMessage, Task`1 response)
   at Microsoft.Graph.Beta.PowerShell.Users.UserGetPhotoContent_Call(HttpRequestMessage request, Func`3 on2Xx, Func`3 onDefault, IEventListener eventListener, ISendAsync sender)
   at Microsoft.Graph.Beta.PowerShell.Users.UserGetPhotoContent_Call(HttpRequestMessage request, Func`3 on2Xx, Func`3 onDefault, IEventListener eventListener, ISendAsync sender)
   at Microsoft.Graph.Beta.PowerShell.Users.UserGetPhotoContent(String userId, Func`3 on2Xx, Func`3 onDefault, IEventListener eventListener, ISendAsync sender)
   at Microsoft.Graph.Beta.PowerShell.Cmdlets.GetMgBetaUserPhotoContent_Get.ProcessRecordAsync()'
Get-MgBetaUserPhotoContent_Get: Cannot set percent because PercentComplete cannot be greater than 100. (Parameter 'value')
Actual value was 2147483647.
DEBUG: [CmdletEndProcessing]: - Get-MgBetaUserPhotoContent end processing.

Module Version

ModuleType Version    PreRelease Name                                ExportedCommands
---------- -------    ---------- ----                                ----------------
Script     2.10.0                Microsoft.Graph.Authentication      {Add-MgEnvironment, Connect-MgGraph, Disconnect-MgGraph, Get-MgContext…}
Script     2.10.0                Microsoft.Graph.Beta.Users          {Get-MgBetaUser, Get-MgBetaUserAppRoleAssignedResource, Get-MgBetaUserAppRoleAssignedResourceCount, Get-MgBetaUserCount…}
Script     2.10.0                Microsoft.Graph.Groups              {Add-MgGroupDriveListContentTypeCopy, Add-MgGroupDriveListContentTypeCopyFromContentTypeHub, Add-MgGroupFavorite, Add-MgGroupSite…}
Script     2.10.0                Microsoft.Graph.Identity.Directory… {Confirm-MgContactMemberGroup, Confirm-MgContactMemberObject, Confirm-MgContractMemberGroup, Confirm-MgContractMemberObject…}
Script     2.10.0                Microsoft.Graph.Identity.SignIns    {Confirm-MgRiskyServicePrincipalCompromised, Confirm-MgRiskyUserCompromised, Get-MgDataPolicyOperation, Get-MgDataPolicyOperationCount…}
Script     2.10.0                Microsoft.Graph.Users               {Get-MgUser, Get-MgUserCount, Get-MgUserCreatedObject, Get-MgUserCreatedObjectAsServicePrincipal…}
Script     2.10.0                Microsoft.Graph.Users.Actions       {Add-MgUserChatMember, Add-MgUserDriveListContentTypeCopy, Add-MgUserDriveListContentTypeCopyFromContentTypeHub, Clear-MgUserChatMessageReaction…}

Environment Data

Name                           Value
----                           -----
PSVersion                      7.4.0
PSEdition                      Core
GitCommitId                    7.4.0
OS                             Darwin 23.1.0 Darwin Kernel Version 23.1.0: Mon Oct  9 21:28:45 PDT 2023; root:xnu-10002.41.9~6/RELEASE_ARM64_T6020
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

jpawlowski avatar Dec 10 '23 18:12 jpawlowski