Browse Category

SharePoint

Hide Sync for Sites via PowerShell in SharePoint Online – Offline Client Availablity

Offline Client Availability is built within SharePoint to “Prevent users from downloading content from a site” via MS support.   There is not a way that I am aware of to fully stop existing syncs, but what is capable is to hide the Sync option from the views within the document library.  This setting can be done at the site and the library level.  

When working at the site level, this setting actually exists at the “Web” level within SharePoint.  This means its not a site collection level and needs to be set per site, including all subsites. 


What it looks like when done

This is what you will see with this setting set to NO:

Modern experience (no sync option)

Classic experience (sync option greyed out)


This is what you see with this setting set to YES:

Modern experience

Classic experience


Setting via Browser

The Offline Client Availability option can be set by single site under…

  1. On the site, click Settings > Site Settings.
  2. Under Search, click Search and offline availability.
  3. In the Offline Client Availability section, select No.


 

Setting via PowerShell powershell2

There was a good discussion going on within the MS Tech Community site around the ability to restrict sync via scripting and I tried to put together what I could to support it.  Obviously it would be tedious to try to set that for all sites and subsites across your tenant.  This was my first published attempt for CSOM so I used some great references to get me through it and this is probably rough around the edges.  All feedback is helpful!

Setting this CSOM web property (ExcludeFromOfflineClient) to true does not disable synchronization. Instead, it represents a recommendation to the client not to attempt synchronization via technet.

Ensure that you update the <script path> section near the header with the path to your CSOM files. Ensure you have at least the August 2016 version of CSOM.  Link to latest Nuget for download.

Link to download most recent version of powershell script from TechNet gallery

16235-illustration-of-a-green-download-button-pv


Used helpful references 

So much good info already out there that helped me get started; Thank you!

Locking a SharePoint Online Site Collection

Within SharePoint Online you have the ability to completely lock down a site collection so no one can get access to it.  This is set via PowerShell and the SharePoint Online Management Shell.  Here are instructions on how to get started using connecting to SharePoint Online via PowerShell.  This lock can also be set on a user’s OneDrive for Business site collection.

Along with the ability to lock a site collection you can also set a redirect URL for the tenant for any locked sites that are accessed.  That means that when a user tries to access that locked site they will be redirected to the URL that you provided at the tenant level.  This could be helpful to provide instructions or further info for anyone letting them know that the site they were trying to access has been locked.  If no redirect URL is set they will receive a 403 error. 

NOTE: As of writing this post you are not able to set a lock state of a site provisioned with an Office 365 Group even though the PS cmdlets say it should be possible.  I will demo the actions later in this post but I have contacted Microsoft on this error and they state it is currently as designed and the error received is incorrect. 

The PowerShell cmdlets that are used to set this up are:


Steps to lock or unlock a site collection

1 – Connect to SharePoint Online

2 – Locking – Set the -LockState of the site collection to “NoAccess” while replacing the domain and sitecollection info to lock the site

  • This can also be a OneDrive for Business site collection (i.e. https://domain-my.sharepoint.com/personal/usersite)

 

2(a) – Unlocking – Set the -LockState of the site collection to “Unlock” while replacing the domain and sitecollection info to unlock the site

3 – Navigate to the URL to confirm and use PowerShell to confirm locked state


Steps to set a tenant redirect URL

1 – Connect to SharePoint Online

2 – Set the NoAccessRedirectURL of the tenant to a URL while replacing the domain and sitecollection info

3 – Navigate to the URL to confirm the redirect.  This may take a few minutes

To remove the NoAccessRedirectURL you can pass in an empty string


Trying to lock an Office 365 Group site

Here is the error you receive when trying to lock a group site:

 

Set-SPOSite : https://domain.sharepoint.com/sites/drewtesto365group is a OneDrive for Business site collection. The only valid parameters for this type of site collection are ‘-Identity’, ‘-StorageQuota’, ‘-StorageWarningLevel’, ‘-LockState’ and ‘-SharingCapability’.
At line:1 char:1
+ Set-SPOSite -Identity https://domain.sharepoint.com/sites/dre …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Set-SPOSite], ServerException
+ FullyQualifiedErrorId : Microsoft.SharePoint.Client.ServerException,Microsoft.Online.SharePoint.PowerShell.SetSite

The error declares it as a OneDrive for Business site collection and says that -LockState is a valid parameter yet still doesn’t work.  I opened a support ticket with Microsoft and this was their resolution:

“It is by design Issue. We can lock a site collection however we cannot lock a unified group site.”

If this is something that you need I would recommend adding to to Uservoice.  If you need to “lock” an Office 365 Group site the best way as it exists when I am writing this is to remove permissions within the group.


Getting status of all locked site collections in a tenant

At this point Get-SPOSite will not return any OneDrive for Business or Group sites.  There is new parameter called “-IncludePersonalSite” which at some point should return OneDrive sites via this cmdlet.  If you run this now you get the error:

WARNING: SharePoint Online does not support these new features yet.

 

Ignite 2016 Info and Thoughts on Announcements for SharePoint – OneDrive – Office 365

2016-09-28-14_49_22-ignite-sharepoint-onedrive-office-365-info

I put together a Microsoft Sway through my Concurrency tenant that wraps up all of the announcements and my thoughts from the collaboration space at Ignite 2016.  This includes info on everything I was able to attend and intake while here in Atlanta.  I used Microsoft Sway so I could continuously update the Sway throughout the conference and after the conference for future review.  My changes are made in real-time and it’s super easy to update.

Link to Sway

SharePoint Designer – Error: Could not save the list changes to the server

I was working with a client recently and tried to create a new form for a list within SharePoint Designer and received the unfriendly error:

Could not save the list changes to the server.

2016-09-22-14_27_48-https___partners-jci-com_sites_20163221517880_itimo

I had created list forms on this list before, so I began back tracking what has changed since I had created one on this list before.  One thing I did was change a set of Lookup columns within the list to point to new lists and removed the old lists where lookup columns used to point to.

When looking at the list columns I found the lookup column that didn’t have a list that it pointed to:

2016-09-22-14_31_28-start

When you go into the column you will see again there is no corresponding list for the lookup:

2016-09-22-14_31_53-change-column-internet-explorer

I deleted the old column and REFRESHED SharePoint Designer.  If you just try to create the form without refreshing you will receive the same error.

2016-09-22-14_41_20-microsoft-edge

Once I refreshed…Voila!

2016-09-22-14_38_56-https___partners-jci-com_sites_20163221517880_itimo

Hopefully if anyone else gets this error this post will be helpful!

 

Changing a site column or content type group to the _Hidden group

Content types and columns use Groups to organize them. These are used so things are easier to find as there are a lot of default columns and content types (600+ columns and 80+ content types). As you turn on more features you will continue to get other content types and columns added to your site for you to use. You can access the site column and site content type through the Site Settings page.

2016-08-16 13_23_11-Jump List for Mozilla Firefox


Once you go into either page you will see the information organized by Groups with a Show Groups drop down on the top right of the page to easily filter.

2016-08-16 13_25_25-Photos


What you WON’T see on either of these pages are a collection hidden content types and columns.  A good example is the overall Title column for the Item content type. This is a very crucial column that is used across many site content types. So if you change the Title column at the site level, it will cascade to all of your content types and lists that are using that column. I have worked with many clients that did not fully understand what they were updating when they did this so it’s fairly common to see a field like this renamed. If you go into the site columns page you will not see this column because it is part of the _Hidden group. If I go in through site content types -> Item -> Title column, you will see that the column exists in the _Hidden group.

2016-08-16 13_31_41-Start


To change the group of this column you can either select an existing group or create a new group.

2016-08-16 13_34_36-Start


Once you make your changes the column or content type that you changed will now be viewable under the site columns or site content types page in the group that you selected.

2016-08-16 13_36_55-Photos


Now what if you wanted to change this back or add a new column or content type to the _Hidden group? When you go back to the edit page you will see that under the Existing group drop down you don’t have the _Hidden option.

2016-08-16 13_38_29-Start


All you need to do is type “_Hidden” in the New group text box and it will move it into the _Hidden group and it will NOT create a new group.

2016-08-16 13_39_49-Start


Now when you go back to the site columns or site content types page you will no longer see what you moved to the _Hidden group.

2016-08-16 13_41_19-Photos