附註: 我們想要以您的語言,用最快的速度為您提供最新的說明內容。 本頁面是經由自動翻譯而成,因此文中可能有文法錯誤或不準確之處。讓這些內容對您有所幫助是我們的目的。希望您能在本頁底部告訴我們這項資訊是否有幫助。 此為 英文文章 出處,以供參考。
使用SharePoint Online頁面是分享想法使用圖像、 Excel、 Word 和 PowerPoint 文件、 視訊及更多的好方法。使用者可以建立並發佈新頁面快速且輕鬆地,及他們具在任何裝置上。
如果您是 Office 365 中的全域管理員或SharePoint管理員,您可允許或防止使用者SharePoint Online網站頁面的建立。您可以執行此整個組織的設定] 來變更SharePoint系統管理中心,或在網站層級使用 Microsoft PowerShell 指令碼。
附註: 下列程序適用於 [僅限SharePoint頁。當您允許建立網站頁面時,在 [設定] 功能表中的 [新增頁面] 命令會建立新網站頁面。如果您關閉 [建立網站頁面的功能,使用者可以仍新增SharePoint頁面,從 [首頁] 頁面上的 [新增] 功能表,並新增 [傳統] 頁面的 Wiki 文件庫使用相同的命令。
允許或防止建立的網站頁面,在組織層級,以在 SharePoint 系統管理中心
-
以全域系統管理員或 SharePoint 系統管理員的身分登入 Office 365。
-
選取左上角的 App 啟動器圖示
,然後選擇 [系統管理] 來開啟 Office 365 系統管理中心。(如果您沒有看到 [系統管理] 磚,表示您在貴組織中沒有 Office 365 系統管理員權限)。
-
在左側窗格中,選擇 [系統管理中心] > [SharePoint]。
-
在左窗格中,選擇 [設定]。
-
旁網站頁面,選取 [允許使用者建立網站頁面或防止使用者建立網站頁面。
防止使用者在特定的網站上建立新頁面,使用 PowerShell
- O365_SPO_DownloadPowerShell
- O365_SPO_Connect-SPOService
附註: 閱讀關於執行原則,並確定您為系統管理員,並執行未簽署的指令碼正確執行原則執行 SharePoint Online 管理命令介面。
-
複製下列程式碼,並將其貼上 「 記事本 」 等文字編輯器。
# Load SharePoint Online Client Components SDK Module Import-Module 'C:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll' # Set script constants $sitePagesFeatureIdString = 'B6917CB1-93A0-4B97-A84D-7CF49975D4EC' # Set up client context $userName = Read-Host "Username" $password = Read-Host "Password" -AsSecureString $siteUrl = Read-Host "Site Url" $webUrl = Read-Host "Server-Relative Web Url" $context = New-Object Microsoft.SharePoint.Client.ClientContext($siteUrl) $credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($userName, $password) $context.Credentials = $credentials # Get the list of existing features $web = $context.Site.OpenWeb($webUrl) $features = $web.Features $context.Load($features) $context.ExecuteQuery() # Verify that the Site Pages feature is present in the web if(($features | ? { $_.DefinitionId -eq $sitePagesFeatureIdString }).Count -eq 0) { Write-Host "The Site Pages feature is already disabled in this web" return } # Remove the Site Pages feature from the web $features.Remove((new-object 'System.Guid' $sitePagesFeatureIdString), $false) $context.ExecuteQuery() # Verify that the Site Pages feature is no longer present in the Web $web = $context.Site.OpenWeb($webUrl) $features = $web.Features $context.Load($features) $context.ExecuteQuery() if(($features | ? { $_.DefinitionId -eq $sitePagesFeatureIdString }).Count -eq 0) { Write-Host "The Site Pages feature has been successfully disabled" } else { throw "The Site Pages feature failed to be disabled" }
-
儲存文字檔案,然後再變更 [副檔名。在此範例中,我們將其命名 SitePagesOut.ps1。
附註: 您可以使用不同的檔案名稱,但您必須將檔案儲存為其副檔名為.ps1 ANSI 編碼文字檔案。
-
變更您用來儲存檔案的目錄。
-
執行下列命令:
./SitePagesOut.ps1
-
指令碼會提示您輸入的SiteUrl和WebUrl。
如果您的網站,例如 「 https://contoso.sharepoint.com/sites/marketing/northwindcompete 」
您想要輸入SiteUrl : https://contoso.sharepoint.com/sites/marketing
與WebUrl您想要輸入sites/marketing/northwindcompete
允許使用者在特定的網站上建立新頁面,使用 PowerShell
- O365_SPO_DownloadPowerShell
- O365_SPO_Connect-SPOService
附註: 閱讀關於執行原則,並確定您為系統管理員,並執行未簽署的指令碼正確執行原則執行 SharePoint Online 管理命令介面。
-
複製下列程式碼,並將其貼上 「 記事本 」 等文字編輯器。
# Load SharePoint Online Client Components SDK Module Import-Module 'C:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll' # Set script constants $sitePagesFeatureIdString = 'B6917CB1-93A0-4B97-A84D-7CF49975D4EC' # Set up client context $userName = Read-Host "Username" $password = Read-Host "Password" -AsSecureString $siteUrl = Read-Host "Site Url" $webUrl = Read-Host "Server-Relative Web Url" $context = New-Object Microsoft.SharePoint.Client.ClientContext($siteUrl) $credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($userName, $password) $context.Credentials = $credentials # Get the list of existing features $web = $context.Site.OpenWeb($webUrl) $features = $web.Features $context.Load($features) $context.ExecuteQuery() # Verify that the Site Pages feature is not present in the web if(($features | ? { $_.DefinitionId -eq $sitePagesFeatureIdString }).Count -gt 0) { Write-Host "The Site Pages feature is already enabled in this web" return } # Add the Site Pages feature back to the web $features.Add((new-object 'System.Guid' $sitePagesFeatureIdString), $false, [Microsoft.SharePoint.Client.FeatureDefinitionScope]::None) $context.ExecuteQuery() # Verify that the Site Pages feature is now present in the web $web = $context.Site.OpenWeb($webUrl) $features = $web.Features $context.Load($features) $context.ExecuteQuery() if(($features | ? { $_.DefinitionId -eq $sitePagesFeatureIdString }).Count -gt 0) { Write-Host "The Site Pages feature has been successfully enabled" } else { throw "The Site Pages feature failed to be enabled" }
-
儲存文字檔案,然後再變更 [副檔名。在此範例中,我們將其命名 SitePagesIn.ps1。
附註: 您可以使用不同的檔案名稱,但您必須將檔案儲存為其副檔名為.ps1 ANSI 編碼文字檔案。
-
變更您用來儲存檔案的目錄。
-
執行下列命令:
./SitePagesIn.ps1
-
指令碼會提示您輸入的SiteUrl和WebUrl。
如果您的網站,例如 「 https://contoso.sharepoint.com/sites/marketing/northwindcompete 」
您想要輸入SiteUrl : https://contoso.sharepoint.com/sites/marketing
與WebUrl您想要輸入sites/marketing/northwindcompete