Connecting SharePoint Online document libraries through the OneDrive client or using the Web interface are the preferred and recommended ways to access document library files on SharePoint. But you can also mount SharePoint Online and OneDrive site libraries in Windows as regular network drives. You can map a SharePoint Online network drive manually or by GPO.
The WebDAV protocol can be used to access SharePoint Online document libraries over HTTPS. This requires the WebClient service to be running in Windows.
Check that the service is running and, if necessary, configure it to start automatically:
Get-Service webclient
Set-Service webclient –startuptype automatic –passthru
Windows 10 and 11 have the WebDAV client built into the OS, but Windows Server 2022/2019/2016 requires a separate feature installation:
Install-WindowsFeature WebDAV-Redirector –Restart
This will install two new services:
To manually map a SharePoint Online document library in Windows, open File Explorer, right-click This PC, and select Map Network Drive.
Select a drive letter and specify the HTTPS path to the target SharePoint site (for example, https://woshub.sharepoint.com/sites/company/Shared%20Documents/General). Enable the Reconnect at sign-in option if required.
However, an error occurs when connecting the network drive:
The mapped network drive could not be created because the following error has occurred:
Access Denied. Before opening files in this location, you must first add the web site to your trusted site list, browse to the web sites, and select the option to login automatically.
To fix this, add your SharePoint site address to the trusted list. Open the Internet Options in the Control Panel (run the inetcpl.cpl command).
Go to the Security tab, select the Trusted sites zone, click Sites, and add the URL address of your SharePoint site.
Then click Custom Level button and change the User Authentication -> Logon value to Automatically logon with current user name and password.
Accessing a SharePoint Online site requires a user to obtain a Microsoft Modern Authentication token. So, open your Internet Explorer (IE) browser and go to https://login.microsoftonline.com/
If the IE browser is disabled on your computer, then use the Internet Explorer Compatibility Mode in Edge for Entra ID (Azure AD) authentication. Add your SharePoint URL under edge://settings/defaultBrowser -> Internet Explorer Mode Pages -> Add.
Perform authentication with your Azure (Microsoft 365) account, and check the option Stay signed in.
This gives you an Entra ID access token valid for 90 days. If the user session is active, this token is automatically renewed.
You can also map a SharePoint Online library as a network drive from the command prompt:
net use T: "https://woshub.sharepoint.com/sites/company/Shared Documents/General" /persistent:yes
Or use the New-PSDrive PowerShell cmdlet:
$SPOLibrary = "https://woshub.sharepoint.com/sites/company/Shared Documents/General"
New-PSDrive -name "Z" -Root $SPOLibrary -PSProvider filesystem
An error may occur when mapping a network drive from the command line:
System error 224 has occurred.
Access Denied. Access Denied. Before opening files in this location, you must first add the web site to your trusted site list….
In this case, check that the SharePoint Online site is added to trusted and that you have authenticated with your Microsoft 365 account (or the authentication token may have expired).
An error will occur if the WebDav client is not installed on the computer:
Error code: 0x80070043
The network name cannot be found.
Now let’s look at how to automatically map a network drive for a SharePoint Online site using Group Policies.
Create a new policy and assign it to the OU containing the target computers on which you want to mount the SharePoint drive.
The Microsoft Authentication window will now open when you start the Edge browser. Enter your username and password and confirm login with MFA. End the user session (logoff). The SharePoint network drive will be automatically mapped via GPO the next time the user logs in.
Some notes about using a SharePoint network drive:
Latest Blog
Monitic provides end-to-end tracking, analysis and data protection services for your company.“