Forum Discussion
Can I unshare files in OneDrive with Powershell
If you have Office 365 E5 go to Security & Compliance and first create a label to detect the content that you want, and auto-apply it on OneDrive locations, then create a DLP policy, select OneDrive locations (all or some users), in Policy settings select "Use advanced settings" -> Conditions: content is shared with people outside my organization -> Action: "Restrict access to the content for external users", then also select to notify user and send alerts to admins.
Or you can also use Cloud App Security: https://portal.cloudappsecurity.com also with O365 E5
https://docs.microsoft.com/en-us/cloud-app-security/data-protection-policies
Thanks for the reply - this is good to know, though it doesn't really apply to my situation as I need to be able to script it and turn off the sharing even to internal users.
I did run through your directions, just to see what was possible and it can be done in our tenant which E3, in case that helps others.
- Pablo R. OrtizFeb 09, 2018Steel ContributorOffice 365 cloud app security file policies is only available for E5 subscriptions, you may see cloud app security portal, but no file policies.
https://support.office.com/en-us/article/overview-of-office-365-cloud-app-security-81f0ee9a-9645-45ab-ba56-de9cbccab475
The same is true for auto applying labels
https://support.office.com/en-us/article/overview-of-labels-af398293-c69d-465e-a249-d74561552d30 - Pablo R. OrtizFeb 09, 2018Steel ContributorYou can try Set-SPOSite –SharingCapability with the user's OneDrive site URL, like https://tenant-my.sharepoint.com/personal/user_name_tenant_onmicrosoft_com
https://blogs.office.com/en-us/2015/09/30/extending-it-and-developer-options-for-odb/