在傳統小組網站上啟用通訊網站體驗

SharePoint 通訊網站 是與組織中其他人共用信息的絕佳工具。 您的使用者可以以可視化的格式分享新聞、報表、狀態和其他資訊。 現在,任何傳統小組網站都可以有這項功能。 藉由執行 PowerShell Cmdlet,您可以將新式通訊網站功能帶入傳統小組網站。

需求

  • 網站必須是 未連線至 Microsoft 365 群組的傳統小組網站, (STS #0 (小組網站傳統體驗) 網站範本) 。
  • 網站必須是網站集合中的最上層網站。 它不能是子網站。
  • 執行 PowerShell Cmdlet 的用戶必須具有目標網站的完整擁有者許可權。
  • 網站不得在網站集合層級啟用 SharePoint Server 發佈基礎結構,或在網站層級啟用 SharePoint Server 發佈。 瞭解如何啟用和停用發佈功能。 如果先前已啟用這些功能,但現在已停用,請移至 網站內容頁面 ,並確定它不包含Pages文檔庫。 深入了解發佈網站上啟用的功能。

這項變更的影響

  • 新的新式頁面會在網站中建立,並設定為首頁。 若要查看變更,請在新的索引標籤 中開啟網站。
  • 任何可存取網站的用戶都會立即看到具有預設網頁元件和內容的新首頁。 在您準備好啟動新的通訊網站體驗之前,您可以將首頁變更回先前的頁面。
  • 有水平流覽的全角頁面可供使用。 (從傳統檢視頂端瀏覽是隱藏的,但可以在傳統頁面上看到,例如網站設定頁面。) 您現在可以自定義此網站上 的導 覽。
  • 網站上不允許自定義腳本
  • 網站頁面連結庫上的次要版本設定已啟用。 深入瞭解版本控制
  • 網站頁面是網站頁面文檔庫中的預設內容類型
  • 不會變更網站許可權。
  • SharePoint 清單和文檔庫體驗不會變更。
  • 網站中啟用的任何內容類型不會變更。
  • 如果傳統網站集合有子網站,則不會變更。
  • 如果您打算啟動此網站作為高流量入口網站,或與大量用戶共享網站,請務必遵循 入口網站啟動指導方針

執行 PowerShell Cmdlet

您可以使用 SharePoint Online 管理命令介面 SharePoint PnP PowerShell,在傳統小組網站上啟用通訊網站體驗。 建議您先使用最少使用的傳統網站來測試體驗,再於組織中的熱門傳統網站上執行。

重要事項

在傳統網站上啟用通訊網站體驗之後,就無法復原變更。

SharePoint 系統管理員指示

  1. 下載最新的 SharePoint Online 管理命令介面。 需要 20122.1200 版或更新版本。

    注意事項

    如果您安裝的是舊版 SharePoint Online 管理命令介面,請移至 [新增或移除程式],並解除安裝 [SharePoint Online 管理命令介面]。

  2. 在 Microsoft 365 以全域系統管理員或 SharePoint 管理員的身分登入。 若要了解如何進行,請參閱開始使用 SharePoint Online 管理命令介面

  3. 執行下列命令:

    Enable-SPOCommSite -SiteUrl <URL of target site>
    

如需此 Cmdlet 的詳細資訊,請參閱 Enable-SPOCommSite

網站系統管理員指示

  1. 瞭解如何使用 SharePoint PnP PowerShell 命令

  2. 在 Windows 10 中,在 PowerShell 中執行下列命令:

    Install-Module SharePointPnPPowerShellOnline
    Connect-PnPOnline –Url <Url of Targetsite> –Credentials (Get-Credential)
    Enable-PnPCommSite
    

常見問題集

此 Cmdlet 是否會變更我所有的傳統網站?

  • 不能。 Cmdlet 可以一次在一個站台上執行。

此 Cmdlet 是否會變更網站範本?

  • 不能。 此 Cmdlet 會啟用通訊網站功能,但月臺仍具有 STS#0 網站範本。 網站在 SharePoint 系統管理中心繼續顯示為「小組網站 (傳統體驗) 」。

為什麼我無法在發佈網站上使用此 Cmdlet?

  • 新式通訊網站體驗與 SharePoint Server 發佈功能不相容。

我可以在組織中的根網站上執行此命令嗎?

  • 是,如果您符合本文開頭所列的需求。

如何取得已啟用通訊網站體驗的所有傳統網站清單?

function Get-CommsiteEnabledSites{

    $adminUrl = Read-Host "Enter the Admin URL of O365 (eg. https://<Tenant Name>-admin.sharepoint.com)"
    $userName = Read-Host "Enter the username of O365 (eg. admin@<tenantName>.onmicrosoft.com)"
    $password = Read-Host "Please enter the password for $($userName)" -AsSecureString

    # set credentials
    $credentials = New-Object -TypeName System.Management.Automation.PSCredential -argumentlist $userName, $password
    $SPOCredentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($userName, $password)

    #connect to to Office 365

    try{

        Connect-SPOService -Url $adminUrl -Credential $credentials
        write-host "Info: Connected succesfully to Office 365" -foregroundcolor green

    }

    catch{

        write-host "Error: Could not connect to Office 365" -foregroundcolor red
        Break connectToO365

    }
    get-siteCollections
}



function get-siteCollections{

    write-host "----- List of classic sites with comm site feature enabled  -------" -foregroundcolor green

#Get all site collections
    $siteCollections = Get-SPOSite

    #loop through all site collections
    foreach ($siteCollection in $siteCollections){

        #set variable for a tab in the table
        $pixelsweb = 0
        $pixelslist = 0
        $enabledCommSite = Get-SPOIsCommSiteEnabled($siteCollection.url)
        $background = "white"
        if($enabledCommSite -ne ""){
            $background = "cyan"
        }
    }
}

function Get-SPOIsCommSiteEnabled($url){

    #fill metadata information to the client context variable
    $featureID = "f39dad74-ea79-46ef-9ef7-fe2370754f6f"
    $context = New-Object Microsoft.SharePoint.Client.ClientContext($url)
    $context.Credentials = $SPOcredentials
    $web = $context.Web
    $context.Load($web)
    $context.load($web.Features)

    try{

        $context.ExecuteQuery()
        $isCommSiteEnabled = $web.Features | Where {$_.DefinitionID -eq $featureID}
        $webTemplate = $web.WebTemplate

        if($webTemplate -ne "SITEPAGEPUBLISHING" -AND $isCommSiteEnabled){
            write-host "Found $($web.url)" -foregroundcolor green
            return "Enabled"

        }
    }
    catch{

        write-host "Could not find web" -foregroundcolor red

    }

    return ""
}

Get-CommsiteEnabledSites

另請參閱

如需在傳統網站上自動將首頁現代化的相關信息,請參閱 傳統首頁現代化