Saturday, March 11, 2017

How to Increase the OneDrive for Business retention and deletion from 30days to 3650days (10 Years)

    I am sure we may have come across this scenario were the customer wants more than 30Day for deleted user OneDrive for Business. The OneDrive Clean Up Job runs, and the user profile is marked for deletion. The profile will be preserved in the database in a deleted state. The default retention period is 30 days but this value can be modified by using the -OrphanedPersonalSitesRetentionPeriod parameter for the Set-SPOTenant cmdlet in the SharePoint Online Management Shell.   


    • From the Start button, choose All Programs, search for SharePoint Online Management Shell  and then Right click on "SharePoint Online Management Shell" and select run as an administrator

    • Run Connect-SPOService. For example, type this command at the prompt:
    For e.g. Connect-SPOService -Url https://contoso-admin.sharepoint.com -credential admin@contoso.onmicrosoft.com  (Press Enter)
    Where URL is the URL of the SharePoint Online Administration Center
    Credential is the user name for Global admin

    • Run the Below Command
    Set-SPOTenant -OrphanedPersonalSitesRetentionPeriod 3650   (Press Enter)

    • Once you press the enter button  you will get the message
    Are you sure you want to perform this action?
    This will update the Retention Policy for All Orphaned OneDrive for Business sites.

    • Click  on "Yes" to update the  update the Retention Policy for All Orphaned OneDrive for Business sites.
    Run the Below Command
    Set-SPOTenant -OrphanedPersonalSitesRetentionPeriod 3650   (Press Enter)

    • Once you press the enter button  you will get the message
    Are you sure you want to perform this action?
    This will update the Retention Policy for All Orphaned OneDrive for Business sites.

    Click  on "Yes" to update the  update the Retention Policy for All Orphaned OneDrive for Business sites.

How to redirect your site collection from one site collection to another

If you would like to redirect your site collection from https://abc.sharepoint.com to https://xyz.sharepoint.com
1. Go to A site collection
2. Edit Page
3. Insert > Web Part
4. Under Media and Content > click on Script Editor > Add
5. Select Script Editor Web Part > click on Web Part Tab > Web Part Properties
6. In web part > click on Edit Snippet
7. Paste the below script

<script '"text/javascript"'>//<![CDATA[alert("This site has been moved to New site. Please check it out . You will be redirected within 5 second.");//]]></script> 

<meta http-equiv="refresh" content="5;url=https://xyz.sharepoint.com">

Restrict users from downloading, printing, and opening in client application.

A) Firstly we configured IRM on your OneDrive for Business default library.

Adding an IRM policy to a library
You can use IRM to help control and protect files that are downloaded from lists or libraries.
1.  Navigate to the library/list you want to configure IRM
2.  On the ribbon, click the Library tab, and then click Library Settings (If you are working in a list, click the List tab, and then click List Settings).
3.  Under Permissions and Management, click Information Rights Management
If the Information Rights Management link does not appear, IRM might not be enabled for your site.
4.  On the Information Rights Management Settings page, select the Restrict permission to documents in this library on download check box to apply restricted permission to documents that are downloaded from this list or library.

We simply gave the policy title and added policy description, clicked on okay.

B) Secondly we checked there were no view permission on your personal site. We created custom view only permission by following the below steps:
Settings > Site Settings > Site Permissions > Permission level  > Add Permission level


C) To change permission for that file we followed the below steps:
-Click on file / folder
-Click on information panel
-Click on advanced
-Click on grant user permission
-Click on Show options and choose the "view only" permission

D)To restrict user from sharing Post Approval from Administrator:

- Go to Settings > Site Settings > Site Permissions
- Click on Access Request Settings > and Select only 'Allow access requests'

- Which allowed users to share however the email invitation will be sent to user post approval of Administrator from (Settings > Site Settings >Access Request and Invitations.)

External sharing allowed to only designated domains



To achieve external sharing for specific domains you can follow the below steps:

1. Go to https://admin.onedrive.com/?v=SharingSettings
2. Under Limit external sharing by domain > click on Allow or block sharing with people on selected domains.
3. Click on Add domains
4. Choose any one

Allow only these domains
OR
Block these domains

5. Enter each domain on a new line.
gmail.com
yahoo.com
hotmail.com

Please refer the attached screen shots for your reference.

Reference article:
https://techcommunity.microsoft.com/t5/OneDrive-for-Business/Announcement-New-OneDrive-Admin-Center-Preview/td-p/35918

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