Skip to content

Commit

Permalink
Merge pull request #662 from reshmee011/reindexsites
Browse files Browse the repository at this point in the history
new sample to reindex sites
  • Loading branch information
pkbullock authored Feb 22, 2024
2 parents 8d7d67d + 6f559ff commit acb9ab7
Show file tree
Hide file tree
Showing 4 changed files with 93 additions and 0 deletions.
38 changes: 38 additions & 0 deletions scripts/spo-reindex-sites/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
plugin: add-to-gallery
---

# Reindex SharePoint sites

## Summary

Keeping your SharePoint environment up-to-date is crucial, especially after making schema changes. This PnP PowerShell script streamlines the process of reindexing sites, libraries, or lists to ensure that search results remain accurate and relevant.

# [PnP PowerShell](#tab/pnpps)

```PowerShell
#Set Parameters
$AdminCenterURL="https://contoso-admin.sharepoint.com"
Connect-PnPOnline -Url $AdminCenterURL -Interactive
$m365Sites = Get-PnPTenantSite -Detailed | Where-Object {($_.Url -like '*/teams-*' -or $_.Template -eq 'TEAMCHANNEL#1') -and $_.Template -ne 'RedirectSite#0' } #filter to exclude redirect sites and to include team channel sites in the list
$m365Sites | ForEach-Object {
Connect-PnPOnline -Url $_.Url -Interactive
#Request Reindex
Request-PnPReIndexWeb
Write-host "Reindexing: " $web $_.Url
}
```

[!INCLUDE [More about PnP PowerShell](../../docfx/includes/MORE-PNPPS.md)]

***

## Contributors
| Author(s) |
|-----------|
| [Reshmee Auckloo](https://github.com/reshmee011)|


[!INCLUDE [DISCLAIMER](../../docfx/includes/DISCLAIMER.md)]
<img src="https://m365-visitor-stats.azurewebsites.net/script-samples/scripts/spo-reindex-sites" aria-hidden="true" />
Binary file added scripts/spo-reindex-sites/assets/example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added scripts/spo-reindex-sites/assets/preview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
55 changes: 55 additions & 0 deletions scripts/spo-reindex-sites/assets/sample.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
[
{
"schema": null,
"name": "spo-reindex-sites",
"version": null,
"source": "pnp",
"title": "Reindex SharePoint sites",
"url": "https://pnp.github.io/script-samples/spo-reindex-sites/README.html",
"creationDateTime": "2024-02-19",
"updateDateTime": "2024-02-19",
"shortDescription": "Keeping your SharePoint environment up-to-date is crucial, especially after making schema changes - this script streamlines the process of reindexing sites, libraries, or lists. ",
"longDescription": null,
"products": [
"SharePoint"
],
"categories": [
"Configure"
],
"tags": [
"Connect-PnPOnline",
"Get-PnPTenantSite",
"Request-PnPReIndexWeb"
],
"metadata": [
{
"key": "PNP-POWERSHELL",
"value": "2.3.0"
}
],
"thumbnails": [
{
"type": "image",
"order": 100,
"url": "https://raw.githubusercontent.com/pnp/script-samples/main/scripts/spo-reindex-sites/assets/preview.png",
"alt": "preview image for the sample",
"slides": null
}
],
"authors": [
{
"gitHubAccount": "reshmee011",
"company": "",
"pictureUrl": "https://avatars.githubusercontent.com/u/7693852?v=4",
"name": "Reshmee Auckloo"
}
],
"references": [
{
"name": "Want to learn more about PnP PowerShell and the cmdlets",
"description": "Check out the PnP PowerShell site to get started and for the reference to the cmdlets.",
"url": "https://aka.ms/pnp/powershell"
}
]
}
]

0 comments on commit acb9ab7

Please sign in to comment.