The Access Denied error with OneDrive are pretty common, even though users are that they have access. Interestingly, the error occurs even for those logging in with administrator accounts.
The causes could be issues with permissions to the file, malware in the system, problems with the administrator accounts, the file could be encrypted or corrupt, etc. We will narrow down the causes one by one and resolve the issue.
Try these preliminary troubleshooting steps before anything else:
1] Scan your system for viruses and malware using any reputable anti-virus tool.
2] Clear the browser cache.
3] Run the Disk Cleanup tool. Search for Disk Cleanup in the Windows search bar and open the application. Select the drive (actually all of them one by one) and run the tool.
4] Uninstall any recently installed suspicious software. Go to Control Panel >> Programs and Features. Right-click and uninstall any such software.
We could proceed to the following solutions after this:
1} Check if the file is working for other users
2} Check the permissions of the specific file
3} Give Full Control to the intended user
4} Add a new administrator account
Solution 1] Check if the file is working for other users
One probability behind the issue is that the file could be corrupt. To confirm that it isn’t the case, ask other users who have access to the file whether they are able to use it or not. Also, check if the file is working well with online OneDrive.
Solution 2] Check the permissions of the specific file
A good way of managing permissions for OneDrive files is through OneDrive online. Make sure that the correct Microsoft online accounts have the right permissions. Also, check the sharing settings and identify what access has been given to the files exactly.
Another way of giving permissions is as follows:
1] Go to the OneDrive folder and right-click on the problematic file. Select Properties.
2] In the Security tab, select the intended user and click on Edit to modify user permissions.
Solution 3] Give Full Control to the intended user
1] Go to the Security tab in the OneDrive properties window as mentioned in Solution 2.
2] Click on Advanced. Then click on Change to modify the permissions.
3] Enter your username in the “Enter the object name to select” field and click on Check Names.
4] Click on OK.
5] Now check the box which says “Replace owner on subcointainers and objects,” and click on Apply and the OK.
Now since you have full ownership over the file or folder, it won’t give the error message again.
This could also be done through Command Prompt:
1] Search in the Windows search bar for Command Prompt and right-click on the icon. Select Run as administrator.
2] Type the following commands and press Enter after each of them to execute them:
takeown /f "C:\<User name of system>" /r /d y icacls "C:\<User name of system>" /grant %<username>% :F /t /q
where <User name of system> is the username of the system and <username> is the user name of the OneDrive user.
3] Let the commands execute and then exit Command Prompt and restart the system.
Solution 4] Add a new administrator account
In case you were the administrator of the system and had the above-mentioned permissions, probably there could be an issue with the administrator account itself. Try the following:
1] Click on the Start button and then the gear-like symbol to open the Settings page.
2] Go to Accounts >> Family & other people.
3] Select Add someone else to this PC and add the details to create a new account.
4] Once the account is added, go to the same page and click on the new account.
5] Select Change account type.
6] Change the Account type to Administrator and click on OK.
7] Restart the system.