There are multiple ways to fetch the OneDrive URL for a user using User Profile through SharePoint Admin panel, through user properties from Microsoft 365 admin Center (also known as Office 365) and through PnP & SharePoint online PowerShell.
Using Microsoft 365 Admin Center
There are two ways to search from Microsoft 365 admin center.
- From Admin center home page, enter user name in the search box. This will search all users, groups, settings and tasks.
- Select the user from drop down, it will open the user details dialog right side.
- Click on Access files link, it will show you the OneDrive URL for the current user. And if you do not have access then it will also assign you administrative access.
Follow below steps to get OneDrive URL access from active users list from Office 365 Admin Center:
- From Office 365 Admin Center, click on active Users and search for the user, select user from the search result as shown in below screenshot.
- User details will be shown on the right side. Click on OneDrive tab and you can get the option to Create Link to files, this will assign administrative access to User’s OneDrive.
Using SharePoint Admin Center
Follow below steps to get OneDrive URL from SharePoint Admin Center:
- Log in to SharePoint admin and click on More Features, this will open the lead you to user profile service link. (in Old admin panel, User Profile link was listed on left navigation).
- You might also need to use user profile page to provision OneDrive for a user and can also disable from here. Click Manage User Profile link on the page.
- Now search by user name and select user profile from the list came from search result. From the search result, click on the menu item “Manage Personal Site” from the context menu.
Using SharePoint Online PowerShell
There are two ways to access OneDrive access for a user Using PowerShell:
SharePoint Online: PowerShell
I am not listing the full powershell script but you can use the blow cmdlets to access Onedrive for a User:
$userId = $ctx.web.EnsureUser("firstname.lastname@example.org")
#Get OneDrive Site URL from User Profile
$peopleManger = New-Object Microsoft.SharePoint.Client.UserProfiles.PeopleManager($ctx)
$profile = $peopleManager.GetPropertiesFor($userId.LoginName)
A simple PowerShell cmdlet from Pnp PowerShell can return you the OneDrive URL of the requested user:
Get-PnPUserProfileProperty -Account $userId | Select PersonalUrl