Discovering URLs for SharePoint Online and OneDrive for Business Sites

URLs Needed for Office 365 Content Searches

The topic of how best to find the URL of someone’s OneDrive for Business account arose in the context of Office 365 content searches. You need to know the URL of any SharePoint Online site or OneDrive for Business account before you can include it in the locations scanned by a content search (Figure 1), eDiscovery case, or Office 365 retention policy.

Some OneDrive for Business accounts added to an Office 365 content search
Figure 1: Some OneDrive for Business accounts added to an Office 365 content search

Finding URLs for SharePoint Sites

Finding the URL of a SharePoint site is straightforward, especially if the site is connected to an Office 365 Group (team). You can:

  • Open the SharePoint site from the group or Teams and note the URL.
  • Run PowerShell to find the URL.
  • Look at the site details in the SharePoint Admin Center to find the URL (Figure 2).
Finding the URL of a site through the SharePoint Admin Center
Figure 2: Finding the URL of a site through the SharePoint Admin Center

We can find the URL with the SharePoint Online PowerShell module or the Exchange Online module. First, here’s SharePoint Online where we use the filter parameter with the Get-SPOSite cmdlet to find all sites containing “Ben” in the URL:

# Find SPO Sites with Ben in the URL
Get-SPOSite -Filter "URL -like 'Ben'"

Url                                                         Owner Storage Quota
---                                                         ----- -------------
https://tenant.sharepoint.com/sites/benowensteam            26214400

The Get-UnifiedGroup cmdlet in the Exchange Online module can return details of any group-enabled site:

# Get SPO details from group
Get-UnifiedGroup -Identity "Ben Owens Team" | Format-list share*

SharePointSiteUrl      : https://tenant.sharepoint.com/sites/benowensteam
SharePointDocumentsUrl : https://tenant.sharepoint.com/sites/benowensteam/Shared
                         Documents
SharePointNotebookUrl  :

Finding URLs for OneDrive for Business Accounts

The OneDrive for Business Admin Center doesn’t list OneDrive accounts: neither does the SharePoint Admin Center. However, we can find the URLs as follows:

  • By accessing a user’s Delve profile and following the link to their OneDrive account.
  • With PowerShell.

PowerShell is probably the easiest method because you can create a list of all OneDrive for Business accounts in the tenant and keep it for easy reference. After connecting to the SharePoint Online PowerShell module with an administrator account, run this command to generate a CSV file with all the links. Figure 3 shows an example of what the CSV file contains.

# Get list of OneDrive for Business accounts and export them to CSV file
Get-SPOSite -IncludePersonalSite $true -Limit all -Filter "Url -like '-my.sharepoint.com/personal/'" | Select Owner, URL | SOrt Owner | Export-CSV c:\temp\OneDriveSites.csv -NoTypeInformation
A list of OneDrive for Business Accounts Generated in CSV format
Figure 3: A list of OneDrive for Business Accounts Generated in CSV format

Apart from being a useful reference, generating a list of OneDrive accounts also allows you to identify any accounts belonging to long-deleted accounts that should no longer be online (I found a couple from 2013).


Tracking down tips like this can be very time-consuming. Wouldn’t it be much better to be able to consult a comprehensive, always up-to-date manual. Something like the Office 365 for IT Pros eBook?

6 Replies to “Discovering URLs for SharePoint Online and OneDrive for Business Sites”

    1. Have you tried? And in any case, you can filter the URLs returned by OneDrive to select just the ones you want to export to the CSV.

  1. we have model driven app in which they are trying to migrate data from another source. we have created a custom table and on the columns they enabled the “Setting up SharePoint document management” setting. we mentioned the connection between the Power Apps table and SharePoint only activates when the record is opened through their Model driven app.

    we would like to know if there is a way to get the SharePoint link of a record without having to open each of the records as this would be way too time consuming.

  2. Is there any method available to do a regex search on SharePoint URLs from a Site Hub, so that users can exclude and include various Site and/or Document Library names from the returned file name results?

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.