Vue normale

Il y a de nouveaux articles disponibles, cliquez pour rafraîchir la page.
À partir d’avant-hierMarc D Anderson's Blog

SharePoint Site Lock and Remove from Search Results

At Sympraxis, we often work with clients who have been using SharePoint for a long time. In many of these cases, they have been using SharePoint basically as a cloud-based file server. At some point in the past, they have done a lift and shift from “on premises” servers (wherever they may live) into SharePoint on premises or SharePoint Online. They are getting little value for their use of the platform, and they want to move up the Microsoft 365 Maturity Model.

One of the things we often need to do is migrate content from its current location into a more refined and purpose-built site topology and information architecture.

When we do that migration, we don’t want to delete the old site(s). Instead, we want to lock them from accidental updates and remove them from the search index. Since we’re migrating the content into new locations, we don’t want to old content to show up in search results.

The PowerShell below is useful in that it allows us to take care of those two steps easily. It’s meant as an example, but it is working code. You might more realistically wrap this in a foreach to apply to multiple sites at the same time.

$tenantName = "your tenant name here"
$spRoot = "https://$($tenantName).sharepoint.com"
$siteCollectionUrlFragment = "foo" # Part of the URL after /sites/, e.g., HRTeam, Marketing, etc.

# Work on this Site Collection
$siteCollection = "$(spRoot)/sites/$($siteCollectionUrlFragment)"

# Connect to Admin Center
$adminSiteUrl = "https://$($tenantName)-admin.sharepoint.com/"
$adminConnection = Connect-PnPOnline -Url $AdminSiteUrl -Interactive
 
# Connect to Site Collection
$siteCollectionConnection = Connect-PnPOnline -Url $siteCollection -Interactive

# Needed to set NoCrawl
Set-PnPSite -Identity $siteCollection -DenyAndAddCustomizePages $false
 
# Exclude Site Collection from Search Index
$Web = Get-PnPWeb -Connection $siteCollectionConnection
$Web.NoCrawl = $true
$Web.Update()
Invoke-PnPQuery

# Lock the site
Set-PnPSite -Identity $siteCollection -LockState ReadOnly

Storman: An Old Workhorse that’s Still Valuable

There probably aren’t a lot of people who use the Storage Management page in SharePoint these days, but I find it really helpful. When we do migrations it’s invaluable, especially when we are looking at a “legacy” – read: classic – pyramid of a Site Collection, with lots of nested subsites. Sure, there are fancier tools – our favorite at Sympraxis is ShareGate Desktop – but good old storman is a great starting point.

By adding the following to a site’s URL: /_layouts/storman.aspx, you’ll see an interactive view of your storage usage for the site. You can also get to the page from the Site Settings; the path varies a bit by SharePoint version, but the link in Site Settings is usually Storage Metrics. I find it’s easier just to type the page on an existing URL for a site.

Here’s an abbreviated example from a classic site we recently worked with a client on to “flatten” the classic subsites into modern sites. (With ShareGate, of course!)

The “containers” below the site are listed in descending order of size, and you can click on any one of them to see the sizes of the content within it, if you choose, all the way to individual files.

This gives us a good high level view of which content is going to take more of our effort. Here, the Company subsite is almost twice as large as its next largest peer.

It would be great if we could choose how to sort the view or filter it, but this is a very old page that Microsoft included first with SharePoint 2007, if I’m not mistaken.

Want to understand where your bigger challenges are going to be as you move from classic to modern or move content around in your modern sites? Storman can be a great help.

❌
❌