Fix Get-PnPUserOneDriveQuota hanging issue by retrieving resolved OneDrive site directly#5306
Fix Get-PnPUserOneDriveQuota hanging issue by retrieving resolved OneDrive site directly#5306gautamdsheth merged 2 commits intodevfrom
Conversation
…Drive site directly
There was a problem hiding this comment.
Pull request overview
Fixes Get-PnPUserOneDriveQuota hanging in some tenants by avoiding filtered tenant site enumeration and instead retrieving the user’s resolved OneDrive site directly.
Changes:
- Replace tenant filtered site query loop with
Tenant.GetSitePropertiesByUrl(personalSiteUrl, includeDetail: true). - Add handling for missing
PersonalUrland forSpoNoSiteExceptionwhen the OneDrive site can’t be resolved. - Add a changelog entry documenting the fix (linked to issue #4543).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/Commands/UserProfiles/GetUserOneDriveQuota.cs | Switches to direct site-property retrieval by URL and adds guarded handling for missing personal site / missing OneDrive site. |
| CHANGELOG.md | Adds a “Fixed” entry describing the hang fix. |
| } while (!string.IsNullOrWhiteSpace(sitesList.NextStartIndexFromSharePoint)); | ||
|
|
||
| var userSite = sitesList.Where(s => s.Url.ToLower() == personalSiteUrl.TrimEnd('/').ToLower()).FirstOrDefault(); | ||
| LogWarning($"Couldn't find onedrive quota for the account: {Account} "); |
There was a problem hiding this comment.
The warning message has a trailing space and uses non-standard capitalization for "OneDrive". Consider removing the trailing space and using "OneDrive" for consistency in user-facing output.
| else | ||
| catch (ServerException e) when (string.Equals(e.ServerErrorTypeName, "Microsoft.Online.SharePoint.Common.SpoNoSiteException", StringComparison.InvariantCultureIgnoreCase)) | ||
| { | ||
| LogWarning($"Couldn't find onedrive quota for the account: {Account} "); |
There was a problem hiding this comment.
Same warning string here includes a trailing space and "onedrive" casing; align with standard "OneDrive" capitalization and remove the trailing space to avoid sloppy user-facing output.
| - Added parameter IncreaseRequestTimeout to `Get-PnPSearchCrawlLog` cmdlet. [#5223](https://github.com/pnp/powershell/pull/5223) | ||
|
|
||
| ### Fixed | ||
| - Fix `Get-PnPUserOneDriveQuota` hanging in some tenants by retrieving the resolved OneDrive site directly instead of using a filtered tenant site query. [#4543](https://github.com/pnp/powershell/issues/4543) |
There was a problem hiding this comment.
This changelog entry links to the issue, but the surrounding entries link to the PR (e.g., #5290, #4868). Update this entry to link to the pull request (and optionally add the issue link separately) to keep changelog references consistent.
| - Fix `Get-PnPUserOneDriveQuota` hanging in some tenants by retrieving the resolved OneDrive site directly instead of using a filtered tenant site query. [#4543](https://github.com/pnp/powershell/issues/4543) | |
| - Fix `Get-PnPUserOneDriveQuota` hanging in some tenants by retrieving the resolved OneDrive site directly instead of using a filtered tenant site query. |
Co-authored-by: Copilot <copilot@github.com>
Type
Related Issues?
Fixes #4543
What is in this Pull Request ?
Use proper tenant method to fetch site details