You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
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.
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
The text was updated successfully, but these errors were encountered:
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
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?
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.
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:
Expected behavior
Completes without:
How to reproduce
``
SDK Version
2.25.0
Latest version known to work for scenario above?
No response
Known Workarounds
No response
Debug output
Configuration
Other information
No response
The text was updated successfully, but these errors were encountered: