Vue normale

Il y a de nouveaux articles disponibles, cliquez pour rafraîchir la page.
À partir d’avant-hierFlux principal

How to Enable or Disable Auto News Digest in SharePoint Online

In today’s fast-paced work environment, staying up to date with the latest news and updates within an organization is crucial. SharePoint Online offers a powerful feature called Auto News Digest, which automatically aggregates the latest news posts from various SharePoint sites and Organization news sites that are relevant to users and sends an automated email to users.

SharePoint uses Microsoft Graph to determine if the news post is relevant for a user or not. SharePoint sends one email digest per week. By leveraging this feature, users can stay informed without having to manually visit each site individually, saving time and ensuring they don’t miss out on important updates.

In some cases, organizations that already have a high volume of emails may choose to disable SharePoint Auto News Digest feature to minimize the number of additional emails being sent to users. You can use any one of the approaches given below for enabling or disabling auto news digest feature in SharePoint online for all users at tenant level.

Using SharePoint Online PowerShell

Use below SharePoint Online PowerShell script to enable or disable the SharePoint auto news digest feature in SharePoint online at tenant level:

# SharePoint online admin center URL
$adminCenterUrl = Read-Host -Prompt "Enter your SharePoint admin center site URL (e.g https://contoso-admin.sharepoint.com/)"

# Connect to SharePoint online admin center
Connect-SPOService -Url $adminCenterUrl

# Enable Auto News Digest in SharePoint Online
Set-SPOTenant -EnableAutoNewsDigest $true

# Disable Auto News Digest in SharePoint Online
Set-SPOTenant -EnableAutoNewsDigest $false

# Disconnect SharePoint online connection
Disconnect-SPOService

Using PnP PowerShell

You can use below PnP PowerShell script for enabling or disabling the SharePoint auto news digest feature in SharePoint online for all users at tenant level: 

# SharePoint online admin center URL
$adminCenterUrl = Read-Host -Prompt "Enter your SharePoint admin center site URL (e.g https://contoso-admin.sharepoint.com/)"

# Connect to SharePoint online admin center
Connect-PnPOnline -Url $adminCenterUrl -Interactive

# Enable Auto News Digest in SharePoint Online
Set-PnPTenant -EnableAutoNewsDigest $true

# Disable Auto News Digest in SharePoint Online
Set-PnPTenant -EnableAutoNewsDigest $false

# Disconnect SharePoint online connection
Disconnect-PnPOnline

Conclusion

SharePoint Auto News Digest is a valuable feature that helps streamline information delivery within organizations. By enabling this feature, SharePoint can automatically compile and deliver news and updates from various SharePoint sites directly to users’ inboxes. Disabling Auto News Digest is also straightforward, allowing organizations to customize their SharePoint experience based on their specific requirements. SharePoint Online PowerShell and PnP PowerShell scripts provide convenient methods to enable or disable Auto News Digest effortlessly, empowering administrators to optimize their SharePoint environment for efficient information sharing.

Learn more

Allow use of custom scripts in SharePoint Online using PowerShell

SharePoint online is a powerful platform that allows users to create and manage websites and content, collaborate with others, and more. However, SharePoint out-of-the-box features may not always meet the specific needs of your organization.

Fortunately, SharePoint online allows the use of custom scripts, which can be used to enhance the platform’s functionality and customize it to your specific needs.

When you allow the use of custom scripts in SharePoint online sites, users gain access to a wide range of features and functionalities. Here are some of the key capabilities that become available:

  • Web Parts: Users can use classic experience web parts like Script Editor, Content Editor (and lot more) using which they can create custom web parts using client-side scripting languages like JavaScript or TypeScript.
  • Use of Save Site as Template, Save document library as template, etc. features in SharePoint.
  • Use of Solution Gallery, Theme Gallery, Sandbox solutions, HTML Field Security, etc. settings in SharePoint sites.
  • Uploading files types that are blocked by default like .asmx .ascx .aspx .htc .jar .master .swf .xap .xsf

Let’s see how you can allow or prevent use of custom scripts in SharePoint Online sites using different PowerShell tools:

Using SharePoint Online PowerShell

Use below SharePoint Online PowerShell script to check if custom scripts are enabled or disabled for a SharePoint online site and then to allow use of custom scripts for specified SharePoint online site:

# SharePoint online admin center URL
$adminCenterUrl = "https://contoso-admin.sharepoint.com/"

# SharePoint online site URL
$siteUrl = "https://contoso.sharepoint.com/sites/SPConnect"

# Connect to SharePoint online admin center
Connect-SPOService -Url $adminCenterUrl

# Allow custom scripts on SharePoint online site
Set-SPOSite $siteUrl -DenyAddAndCustomizePages 0

# Verify that custom scripts are enabled on SharePoint online site
Get-SPOSite $siteUrl | select DenyAddAndCustomizePages

Using PnP PowerShell

You can use below PnP PowerShell script to allow or prevent use of custom scripts in SharePoint online site:

# SharePoint online site URL
$siteUrl = "https://contoso.sharepoint.com/sites/SPConnect"

# Connect to SharePoint online site
Connect-PnPOnline -Url $siteUrl -Interactive

# Allow custom scripts on SharePoint online site
Set-PnPSite -NoScriptSite $false

# Prevent custom scripts on SharePoint online site
Set-PnPSite -NoScriptSite $true

Using CLI For Microsoft 365

Use below CLI for Microsoft 365 script to allow use of custom scripts in SharePoint online site collection:

# SharePoint online site URL
$siteUrl = "https://contoso.sharepoint.com/sites/SPConnect"

# Connect to SharePoint online tenant
$m365Status = m365 status
if ($m365Status -match "Logged Out") {
    m365 login
}

# Allow custom scripts on SharePoint online site collection
m365 spo site set --url $siteUrl --noScriptSite $false

Conclusion

Enabling custom script support for SharePoint online sites can enhance the platform’s functionality and enable users to customize site to their specific needs. However, it’s important to carefully consider the potential security risks before enabling this feature, check: security considerations of allowing custom scripts in SharePoint.

Learn more

Delete custom site scripts in SharePoint online

In SharePoint online, you can use Site templates (previously known as “Site designs”) and Site scripts to provide reusable site columns, content types, lists, themes, site navigation layouts, or custom actions so that your users can quickly build new SharePoint sites with the features they need. SharePoint custom site scripts can help you to add custom branding, theming, or automation like setting a site logo, activating a site feature, etc. to your SharePoint online site.

However, over time, these custom site scripts can become outdated or unnecessary and ends up just hanging around in your SharePoint tenant for a long time even though you no longer need them. In this blog, we will discuss how to delete the custom SharePoint site scripts using PowerShell “scripts” (pun intended).

Using SharePoint Online PowerShell

You can run below SharePoint online PowerShell script from SharePoint Online Management Shell to delete the custom site scripts in your tenant:

# SharePoint online admin site URL
$siteUrl = "https://contoso-admin.sharepoint.com/"

# Connect to SharePoint online admin center
Connect-SPOService -Url $siteUrl

# Get all site scripts from the current tenant
$siteScripts = Get-SPOSiteScript

# List of custom site scripts to exclude from deletion
$keepThese = "Base Site Settings", "English Region", "Standard Site Columns", "Standard Libraries"
$siteScripts = $siteScripts | Where-Object { -not ($keepThese -contains $_.Title)}

if ($siteScripts.Count -eq 0) { break }

$siteScripts | Format-Table Title, SiteScriptIds, Description

Read-Host -Prompt "Press Enter to start deleting (CTRL + C to exit)"
$progress = 0
$total = $siteScripts.Count

foreach ($siteScript in $siteScripts)
{
    $progress++
    Write-Host $progress / $total":" $siteScript.Title

    # Delete custom site script
    Remove-SPOSiteScript -Identity $siteScript.Id
}

# Disconnect SharePoint online connection
Disconnect-SPOService

Using PnP PowerShell

Use below PnP PowerShell script to delete the custom site scripts from SharePoint online tenant:

# SharePoint online admin site URL
$siteUrl = "https://contoso-admin.sharepoint.com/"

# Connect to SharePoint online admin center
Connect-PnPOnline -Url $siteUrl -Interactive

# Get all site scripts from the current tenant
$siteScripts = Get-PnPSiteScript

# List of custom site scripts to exclude from deletion
$keepThese = "Base Site Settings", "English Region", "Standard Site Columns", "Standard Libraries"
$siteScripts = $siteScripts | Where-Object { -not ($keepThese -contains $_.Title)}

if ($siteScripts.Count -eq 0) { break }

$siteScripts | Format-Table Title, SiteScriptIds, Description

Read-Host -Prompt "Press Enter to start deleting (CTRL + C to exit)"
$progress = 0
$total = $siteScripts.Count

foreach ($siteScript in $siteScripts)
{
    $progress++
    Write-Host $progress / $total":" $siteScript.Title

    # Delete custom site script
    Remove-PnPSiteScript -Identity $siteScript.Id
}

# Disconnect SharePoint online connection
Disconnect-PnPOnline

Using CLI for Microsoft 365

Use below CLI for Microsoft 365 script to remove custom SharePoint site scripts from your tenant:

# Get credentials to connect to SharePoint online tenant
$m365Status = m365 status
if ($m365Status -match "Logged Out") {
    m365 login
}

# Get all site scripts from the current tenant
$siteScripts = m365 spo sitescript list | ConvertFrom-Json

# List of custom site scripts to exclude from deletion
$keepThese = "Base Site Settings", "English Region", "Standard Site Columns", "Standard Libraries"
$siteScripts = $siteScripts | Where-Object { -not ($keepThese -contains $_.Title)}

if ($siteScripts.Count -eq 0) { break }

$siteScripts | Format-Table Title, SiteScriptIds, Description

Read-Host -Prompt "Press Enter to start deleting (CTRL + C to exit)"
$progress = 0
$total = $siteScripts.Count

foreach ($siteScript in $siteScripts)
{
    $progress++
    Write-Host $progress / $total":" $siteScript.Title

    # Delete custom site script
    m365 spo sitescript remove --id $siteScript.Id
}

# Disconnect SharePoint online connection
m365 logout

These PowerShell scripts are also available on PnP Script Samples site at: Delete custom SharePoint site scripts.

Learn more

❌
❌