Skip to content

Add Get-PnPUserOneDriveLocation cmdlet#5382

Merged
gautamdsheth merged 2 commits into
devfrom
gautamdsheth-get-user-onedrive-location
Jul 4, 2026
Merged

Add Get-PnPUserOneDriveLocation cmdlet#5382
gautamdsheth merged 2 commits into
devfrom
gautamdsheth-get-user-onedrive-location

Conversation

@gautamdsheth

Copy link
Copy Markdown
Collaborator

Summary

  • Added Get-PnPUserOneDriveLocation using the existing SharePoint Online multi-geo REST client.
  • Added the UserPersonalSiteLocation output model with UserPrincipalName, Location, MySiteUrl, and SiteId properties.
  • Added cmdlet documentation and a Current nightly changelog entry.

Validation

  • dotnet restore src\PnP.PowerShell.sln
  • dotnet build src\PnP.PowerShell.sln --no-restore --verbosity minimal
  • Imported the built debug module and verified Get-PnPUserOneDriveLocation syntax/metadata.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 4, 2026 20:46

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a new tenant-admin cmdlet, Get-PnPUserOneDriveLocation, which returns SharePoint Online multi-geo location details (location code, OneDrive URL, site ID) for a user's OneDrive personal site. It reuses the existing internal MultiGeoRestApiClient and follows the established pattern of the sibling multi-geo admin cmdlets (base class, permission attributes, REST version negotiation, and case-insensitive deserialization).

Changes:

  • Added a GetUserPersonalSiteLocation method to MultiGeoRestApiClient, targeting the UserPersonalSiteLocation('{upn}') REST path.
  • Added the UserPersonalSiteLocation output model and the Get-PnPUserOneDriveLocation cmdlet, plus its documentation.
  • Added a Current nightlyAdded changelog entry.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/Commands/Utilities/MultiGeo/MultiGeoRestApiClient.cs Adds the REST method and constants to fetch a user's personal site location; consistent with existing lookups.
src/Commands/Model/UserPersonalSiteLocation.cs New output model with UserPrincipalName, Location, MySiteUrl, SiteId; matches sibling model conventions.
src/Commands/Admin/GetUserOneDriveLocation.cs New cmdlet; missing [ValidateNotNullOrEmpty] on UserPrincipalName compared to sibling cmdlets.
documentation/Get-PnPUserOneDriveLocation.md New cmdlet docs; structure and alphabetical parameter order are consistent.
CHANGELOG.md Adds the nightly entry; missing the PR link used by all sibling entries.

Comment thread src/Commands/Admin/GetUserOneDriveLocation.cs
Comment thread CHANGELOG.md Outdated
## [Current nightly]

### Added
- Added `Get-PnPUserOneDriveLocation` cmdlet to retrieve SharePoint Online multi-geo location details for a user's OneDrive personal site.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Added the PR link to the Current nightly changelog entry.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@gautamdsheth gautamdsheth merged commit 771cc85 into dev Jul 4, 2026
5 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.

2 participants