Skip to content

Fix Get-PnPUserOneDriveQuota hanging issue by retrieving resolved OneDrive site directly#5306

Merged
gautamdsheth merged 2 commits intodevfrom
fix/4543-onedrive
Apr 28, 2026
Merged

Fix Get-PnPUserOneDriveQuota hanging issue by retrieving resolved OneDrive site directly#5306
gautamdsheth merged 2 commits intodevfrom
fix/4543-onedrive

Conversation

@gautamdsheth
Copy link
Copy Markdown
Collaborator

Type

  • Bug Fix
  • New Feature
  • Sample

Related Issues?

Fixes #4543

What is in this Pull Request ?

Use proper tenant method to fetch site details

Copilot AI review requested due to automatic review settings April 28, 2026 19:46
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 PersonalUrl and for SpoNoSiteException when 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} ");
Copy link

Copilot AI Apr 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
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} ");
Copy link

Copilot AI Apr 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment thread CHANGELOG.md Outdated
- 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)
Copy link

Copilot AI Apr 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
- 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.

Copilot uses AI. Check for mistakes.
Co-authored-by: Copilot <copilot@github.com>
@gautamdsheth gautamdsheth merged commit 02aa812 into dev Apr 28, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]Get-PnPUserOneDriveQuota (possibly Education tenant related?)

2 participants