Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
gjhardie opened this issue Feb 5, 2025 · 3 comments

Comments

@gjhardie
Copy link

gjhardie commented Feb 5, 2025

Describe the bug

I'm trying to down load a file from SharePoint using Get-MgDriveItemContent. This has worked previously without an error.

I've had to change environment by way of running this code on Windows Server 2022...previously Windows Server 2016

Now I get this:

Get-MgDriveItemContent_Get: <script name>.ps1:1273:13
Line |
1273 |              Get-MgDriveItemContent -DriveId $fileItem.parentReference …
     |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Cannot set percent because PercentComplete cannot be greater than 100. (Parameter 'value') Actual value was 2147483647.

Expected behavior

Completes without:

Get-MgDriveItemContent_Get: <script name>.ps1:1273:13
Line |
1273 |              Get-MgDriveItemContent -DriveId $fileItem.parentReference …
     |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Cannot set percent because PercentComplete cannot be greater than 100. (Parameter 'value') Actual value was 2147483647.

How to reproduce

$accConfFileList = get-FolderFileItemList $SiteURL $newSPInputFolder
foreach ($fileItem in ($accConfFileList)) {
    Get-MgDriveItemContent -DriveId $fileItem.parentReference.driveId -DriveItemId $fileItem.id -OutFile "$inputFilePath"
}

``

SDK Version

2.25.0

Latest version known to work for scenario above?

No response

Known Workarounds

No response

Debug output

DEBUG: [CmdletBeginProcessing]: - Get-MgDriveItemContent begin processing with parameterSet 'Get'.
DEBUG: [Authentication]: - AuthType: 'AppOnly', TokenCredentialType: 'ClientSecret', ContextScope: 'Process', AppName: 'Redacted'.
DEBUG: [Authentication]: - Scopes: [Files.ReadWrite.AppFolder, DeviceManagementManagedDevices.Read.All, Group.Read.All, Files.SelectedOperations.Selected, Sites.Read.All, DeviceManagementServiceConfig.Read.All, Sites.ReadWrite.All, Sites.Manage.All, Directory.Read.All, DeviceManagementRBAC.Read.All, Files.Read.All, DeviceManagementConfiguration.Read.All, Lists.SelectedOperations.Selected].
DEBUG: ============================ HTTP REQUEST ============================

HTTP Method: GET

Absolute Uri: <Redacted>

Headers:
FeatureFlag                   : 00000043
Cache-Control                 : no-store, no-cache
User-Agent                    : Mozilla/5.0,(Windows NT 10.0; Microsoft Windows 10.0.20348; en-GB),PowerShell/2025.0.0
Accept-Encoding               : gzip
SdkVersion                    : graph-powershell/2.25.0,
client-request-id             : <Redacted>

Body: <Redacted>

DEBUG: ============================ HTTP RESPONSE ============================

Status Code:
OK

Headers:
Cache-Control                 : private
Accept-Ranges                 : bytes
ETag                          : "{4EAB61C4-39C7-427E-97FF-C176C44AC10B},2"
P3P                           : CP="ALL IND DSP COR ADM CONo CUR CUSo IVAo IVDo PSA PSD TAI TELo OUR SAMo CNT COM INT NAV ONL PHY PRE PUR UNI"
X-NetworkStatistics           : 0,1573888,0,0,4710826,0,1573888,7
X-SharePointHealthScore       : 3
docID                         : <Redacted>
X-Download-Options            : noopen
CTag                          : {4EAB61C4-39C7-427E-97FF-C176C44AC10B},2,4
X-AspNet-Version              : 4.0.30319
IsOCDI                        : 0
X-DataBoundary                : EU
X-1DSCollectorUrl             : https://eu-mobile.events.data.microsoft.com/OneCollector/1.0/
X-AriaCollectorURL            : https://eu-mobile.events.data.microsoft.com/Collector/3.0
SPRequestGuid                 : <Redacted>
request-id                    : <Redacted>
MS-CV                         : <Redacted>
Alt-Svc                       : h3=":443"
Report-To                     : {"group":"network-errors","max_age":7200,"endpoints":[{"url":"<Redacted>"}]}
NEL                           : {"report_to":"network-errors","max_age":7200,"success_fraction":0.001,"failure_fraction":1.0}
Strict-Transport-Security     : max-age=31536000
X-Frame-Options               : SAMEORIGIN
Content-Security-Policy       : frame-ancestors 'self' teams.microsoft.com *.teams.microsoft.com *.skype.com *.teams.microsoft.us local.teams.office.com teams.cloud.microsoft *.office365.com goals.cloud.microsoft *.powerapps.com *.powerbi.com *.yammer.com engage.cloud.microsoft word.cloud.microsoft excel.cloud.microsoft powerpoint.cloud.microsoft *.officeapps.live.com *.office.com *.microsoft365.com m365.cloud.microsoft *.cloud.microsoft *.stream.azure-test.net *.microsoftstream.com *.dynamics.com *.microsoft.com onedrive.live.com *.onedrive.live.com securebroker.sharepointonline.com;
X-Powered-By                  : ASP.NET
MicrosoftSharePointTeamServices: 16.0.0.25715
X-Content-Type-Options        : nosniff
X-MS-InvokeApp                : 1; RequireReadOnly
X-Cache                       : CONFIG_NOCACHE
X-MSEdge-Ref                  : <Redacted>
Date                          : Wed, 05 Feb 2025 13:51:03 GMT

Body: <Redacted>

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.PowerShell.PSCmdletExtensions.GetProgress(ProgressRecord currentProgressRecord, Stream stream)
   at Microsoft.Graph.PowerShell.PSCmdletExtensions.WriteToStream(PSCmdlet cmdlet, Stream inputStream, Stream outputStream, String downloadUrl, CancellationToken cancellationToken)
   at Microsoft.Graph.PowerShell.PSCmdletExtensions.WriteToFile(PSCmdlet cmdlet, HttpResponseMessage response, Stream inputStream, String filePath, CancellationToken cancellationToken)
   at Microsoft.Graph.PowerShell.Cmdlets.GetMgDriveItemContent_Get.on2Xx(HttpResponseMessage responseMessage, Task`1 response)
   at Microsoft.Graph.PowerShell.Files.DriveGetItemsContent_Call(HttpRequestMessage request, Func`3 on2Xx, Func`3 onDefault, IEventListener eventListener, ISendAsync sender)
   at Microsoft.Graph.PowerShell.Files.DriveGetItemsContent_Call(HttpRequestMessage request, Func`3 on2Xx, Func`3 onDefault, IEventListener eventListener, ISendAsync sender)
   at Microsoft.Graph.PowerShell.Files.DriveGetItemsContent(String driveId, String driveItemId, String Format, IDictionary headers, Func`3 on2Xx, Func`3 onDefault, IEventListener eventListener, ISendAsync sender)
   at Microsoft.Graph.PowerShell.Cmdlets.GetMgDriveItemContent_Get.ProcessRecordAsync()'
Get-MgDriveItemContent_Get: <script name>.ps1:1273:13
Line |
1273 |              Get-MgDriveItemContent -DriveId $fileItem.parentReference …
     |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Cannot set percent because PercentComplete cannot be greater than 100. (Parameter 'value') Actual value was 2147483647.
DEBUG: [CmdletEndProcessing]: - Get-MgDriveItemContent end processing.
$_.ScriptStackTrace
at Get-MgDriveItemContent<Process>, C:\Program Files\PowerShell\Modules\Microsoft.Graph.Files\2.25.0\exports\ProxyCmdletDefinitions.ps1: line 6632

Configuration

Name                           Value
----                           -----
PSVersion                      7.5.0
PSEdition                      Core
GitCommitId                    7.5.0
OS                             Microsoft Windows 10.0.20348
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Other information

No response

@gjhardie gjhardie added status:waiting-for-triage An issue that is yet to be reviewed or assigned type:bug A broken experience labels Feb 5, 2025
@timayabi2020
Copy link
Contributor

timayabi2020 commented Feb 5, 2025

Hi @gjhardie I think this is more of an environment issue than an SDK issue.
You can try adding $ProgressPreference = "SilentlyContinue" in your script and ensure that your server is up to date because some builds may be having PowerShell related bugs

@timayabi2020 timayabi2020 added feedback status:waiting-for-author-feedback Issue that we've responded but needs author feedback to close area: PowerShell 5.1 and removed status:waiting-for-triage An issue that is yet to be reviewed or assigned labels Feb 5, 2025
@gjhardie
Copy link
Author

gjhardie commented Feb 5, 2025

Hi @timayabi2020,
Thanks for your response. With environment issue could you be more specific. All $ProgressPreference = "SilentlyContinue" is doing is masking progress functionality that should be working in the command and clearly isn't. The file still gets downloaded. Why did you add area: PowerShell 5.1, when the version in use is 7.5.0?

@microsoft-github-policy-service microsoft-github-policy-service bot added Needs: Attention 👋 and removed status:waiting-for-author-feedback Issue that we've responded but needs author feedback to close labels Feb 5, 2025
@gjhardie
Copy link
Author

gjhardie commented Feb 6, 2025

This problem is not resolved as:

1. $ProgressPreference = "SilentlyContinue" just masks the issue and stops progress functionality.
2. From an environment perspective the latest versions of PowerShell, SDK, VS Code & OS are being used.

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

No branches or pull requests

2 participants