Saturday, March 11, 2017

How to Lock Site Collection in SharePoint Online and have redirect users to another site


Requirement:

When users browse to the site collection https://domain.sharepoint.com/sites/sitecollection1 it should be locked and they should be re-directed to another page and should be notified about the same.

I created a page called it "Lock-Site.aspx" under root site collection https://domain.sharepoint.com/ and gave view permission to everyone group specifically on the page where I have added text message "The site that you are trying to access has been locked by the IT Department. If you have any questions please contact Administrator admin@domain.onmicrosoft.com"

I ran below command to achieve this.

1. Set-SPOSite -Identity https://domain.sharepoint.com/sites/sitecollection1 -LockState "NoAccess"
2. Set-SPOTenant -NoAccessRedirectUrl "https://domain.sharepoint.com/SitePages/Lock-Site.aspx"

Behavior:

When the users try browsing the site https://domain.sharepoint.com/sites/sitecollection1 they would redirect to https://domain.sharepoint.com/SitePages/Lock-Site.aspx which states "The site that you are trying to access has been locked by the IT Department. If you have any questions please contact Administrator admin@domain.onmicrosoft.com"


How to remove OneDrive for Business / OneDrive Personal link from the Explorer Side Panel in Windows OS


For OneDrive for Business please follow the below steps:

Go to Run > Type Regedit > Search for "OneDrive - Company Name" and you will find the location

Computer\HKEY_CLASSES_ROOT\CLSID\{XXXX-XXXX-XXXX-XXXX-XXXXXX}

Where In the subkey System.IsPinnedToNameSpaceTree changed the DWORD from 1 to 0.

Important Note: Make sure you take a back up of registry before making any changes.



For OneDrive Personal
Go to Run > Type Regedit > Search for "OneDrive - Personal" you will find the location
Where In the subkey System.IsPinnedToNameSpaceTree changed the DWORD from 1 to 0.



For Personal mostly the key would be same {HKEY_CLASSES_ROOT\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}.


Important Note: Make sure you take a back up of registry before making any changes.


After making changes in registry in both scenario restart the system and check you should not view the link anymore.

Search Box