-
Notifications
You must be signed in to change notification settings - Fork 409
Add Get-PnPUserOneDriveLocation cmdlet #5382
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| --- | ||
| Module Name: PnP.PowerShell | ||
| title: Get-PnPUserOneDriveLocation | ||
| schema: 2.0.0 | ||
| applicable: SharePoint Online | ||
| external help file: PnP.PowerShell.dll-Help.xml | ||
| online version: https://pnp.github.io/powershell/cmdlets/Get-PnPUserOneDriveLocation.html | ||
| --- | ||
|
|
||
| # Get-PnPUserOneDriveLocation | ||
|
|
||
| ## SYNOPSIS | ||
| Returns the SharePoint Online multi-geo location details for a user's OneDrive personal site. | ||
|
|
||
| ## SYNTAX | ||
|
|
||
| ```powershell | ||
| Get-PnPUserOneDriveLocation -UserPrincipalName <String> [-Connection <PnPConnection>] | ||
| ``` | ||
|
|
||
| ## DESCRIPTION | ||
| Returns the SharePoint Online multi-geo location, OneDrive personal site URL, site ID, and user principal name for the specified user. | ||
|
|
||
| ## EXAMPLES | ||
|
|
||
| ### EXAMPLE 1 | ||
|
|
||
| ```powershell | ||
| Get-PnPUserOneDriveLocation -UserPrincipalName user@contoso.com | ||
| ``` | ||
|
|
||
| Returns the OneDrive personal site location details for the specified user. | ||
|
|
||
| ## PARAMETERS | ||
|
|
||
| ### -Connection | ||
| Optional connection to be used by the cmdlet. Retrieve the value for this parameter by specifying `-ReturnConnection` on `Connect-PnPOnline` or by executing `Get-PnPConnection`. | ||
|
|
||
| ```yaml | ||
| Type: PnPConnection | ||
| Parameter Sets: (All) | ||
|
|
||
| Required: False | ||
| Position: Named | ||
| Default value: None | ||
| Accept pipeline input: False | ||
| Accept wildcard characters: False | ||
| ``` | ||
|
|
||
| ### -UserPrincipalName | ||
| The user principal name of the user whose OneDrive personal site location details should be returned. | ||
|
|
||
| ```yaml | ||
| Type: String | ||
| Parameter Sets: (All) | ||
|
|
||
| Required: True | ||
| Position: Named | ||
| Default value: None | ||
| Accept pipeline input: False | ||
| Accept wildcard characters: False | ||
| ``` | ||
|
|
||
| ## OUTPUTS | ||
|
|
||
| ### PnP.PowerShell.Commands.Model.UserPersonalSiteLocation | ||
| Returns an object with `UserPrincipalName`, `Location`, `MySiteUrl`, and `SiteId` properties. | ||
|
|
||
| ## RELATED LINKS | ||
|
|
||
| [Get-PnPUserAndContentMoveState](Get-PnPUserAndContentMoveState.md) | ||
|
|
||
| [Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| using PnP.PowerShell.Commands.Attributes; | ||
| using PnP.PowerShell.Commands.Base; | ||
| using PnP.PowerShell.Commands.Model; | ||
| using PnP.PowerShell.Commands.Utilities.MultiGeo; | ||
| using System.Management.Automation; | ||
|
|
||
| namespace PnP.PowerShell.Commands.Admin | ||
| { | ||
| [Cmdlet(VerbsCommon.Get, "PnPUserOneDriveLocation")] | ||
| [RequiredApiApplicationPermissions("sharepoint/Sites.FullControl.All")] | ||
| [RequiredApiDelegatedPermissions("sharepoint/AllSites.FullControl")] | ||
| [OutputType(typeof(UserPersonalSiteLocation))] | ||
| public class GetUserOneDriveLocation : PnPSharePointOnlineAdminCmdlet | ||
| { | ||
| [Parameter(Mandatory = true)] | ||
| [ValidateNotNullOrEmpty] | ||
| public string UserPrincipalName { get; set; } | ||
|
|
||
| protected override void ExecuteCmdlet() | ||
| { | ||
| var multiGeoRestApiClient = new MultiGeoRestApiClient(AdminContext); | ||
| WriteObject(multiGeoRestApiClient.GetUserPersonalSiteLocation(UserPrincipalName)); | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| using System; | ||
|
|
||
| namespace PnP.PowerShell.Commands.Model | ||
| { | ||
| /// <summary> | ||
| /// Contains the SharePoint Online multi-geo location details for a user's OneDrive personal site. | ||
| /// </summary> | ||
| public class UserPersonalSiteLocation | ||
| { | ||
| /// <summary> | ||
| /// The user principal name for the OneDrive owner. | ||
| /// </summary> | ||
| public string UserPrincipalName { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// The SharePoint Online multi-geo location code for the user's OneDrive personal site. | ||
| /// </summary> | ||
| public string Location { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// The URL of the user's OneDrive personal site. | ||
| /// </summary> | ||
| public string MySiteUrl { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// The site collection identifier of the user's OneDrive personal site. | ||
| /// </summary> | ||
| public Guid SiteId { get; set; } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.