Knowledge Base

How to resolve problems with accessing SharePoint Online sites in CodeTwo Backup


When configuring or running backup/restore jobs in CodeTwo Backup, you get one of the following errors:

Cannot contact site at the specified URL <site URL>. Access to this site has been blocked.
Cannot contact site at the specified URL <site URL>. There is no Web named <site URL>.
You can’t choose this option because the original site collection no longer exists on the original server. Choose or create another site collection.


 These errors occur when CodeTwo Backup attempts to access a SharePoint Online site that has been locked:

  • before configuring a backup/restore job,
  • after completing the configuration, but before running a backup/restore job.

To solve the problem, you need to unlock the sites that are causing the errors. The most effective way to do this is by using PowerShell.

Connecting to the SharePoint Online Administration Center with PowerShell

Connect to SharePoint Online in the following way:

  1. Run PowerShell on your machine.
  2. Connect to the SharePoint Online Administration Center by using the following cmdlet:
Connect-SPOService -Url https://<org-name>

Replace the <org-name> with the name of your SharePoint organization.

  1. Provide your SharePoint Online Administrator or Global Administrator login and password in the window that appears to sign in.

Read this article if you need more information about connecting to SharePoint Online with PowerShell.

Generating a list of locked SharePoint Online sites

Use the following cmdlet to display the list of all locked sites in your organization:

Get-SPOSite -Filter {LockState -eq NoAccess}


Depending on your scenario and the type of error you are getting, only one SharePoint Online site may be specified in the error message. This cmdlet lists all locked sites, so consider unlocking all of them, if you intend to back them up or restore data to these sites with CodeTwo Backup.

Unlocking a single SharePoint Online site

To enable access to a single SharePoint Online site, use the following cmdlet:

Set-SPOSite -Identity <locked site URL> -LockState Unlock

where <locked site URL> is the URL of the site listed in the error message.

Unlocking all SharePoint Online sites

To change the status of all locked SharePoint sites, use the following cmdlet:

Get-SPOSite -Filter {LockState -eq NoAccess} | Set-SPOSite -LockState Unlock

If you would like to exclude some of the locked sites, you can use additional filters, as discussed on this Microsoft site.

Was this information useful?