ค้นหาเว็บไซต์

SharePoint Online: เปลี่ยนจากประสบการณ์แบบคลาสสิกเป็นสมัยใหม่ (และในทางกลับกัน) โดยใช้ PowerShell


ความต้องการ: เปลี่ยนไซต์ SharePoint Online จาก Classic Experience เป็น Modern

จะเปิดใช้งานประสบการณ์สมัยใหม่จาก Classic ได้อย่างไร

ประสบการณ์การใช้งานที่ทันสมัยในรายการและไลบรารีของ SharePoint Online เร็วขึ้น เป็นมิตรกับอุปกรณ์เคลื่อนที่ และใช้งานได้ง่ายขึ้น โดยนำเสนอฟังก์ชันการทำงาน อินเทอร์เฟซผู้ใช้ และส่วนประกอบใหม่ๆ อย่างไรก็ตาม คุณลักษณะบางอย่างสามารถใช้ได้เฉพาะในประสบการณ์แบบคลาสสิกเท่านั้น ดังนั้น คุณอาจต้องสลับระหว่าง UI สมัยใหม่และประสบการณ์แบบคลาสสิกใน SharePoint Online ฉันจะเปลี่ยนจากมุมมองคลาสสิกเป็นมุมมองสมัยใหม่ใน SharePoint ได้อย่างไร เมื่อต้องการเปิดใช้งานประสบการณ์ไลบรารีสมัยใหม่ใหม่ใน SharePoint Online ให้ใช้ลิงก์ "ออกจากประสบการณ์แบบคลาสสิก" ที่มุมล่างซ้าย

นี่เป็นการเปิดประสบการณ์ที่ทันสมัย จะเปลี่ยนกลับไปเป็นแบบคลาสสิกใน SharePoint Online ได้อย่างไร หากต้องการปิดใช้งานประสบการณ์สมัยใหม่และเปลี่ยนกลับเป็นแบบคลาสสิกใน SharePoint Online ให้ใช้ลิงก์ "กลับสู่ SharePoint แบบคลาสสิก"

ในกรณีที่คุณไม่ได้รับ "กลับสู่ SharePoint แบบคลาสสิก" หรือ "ออกจากประสบการณ์แบบคลาสสิก" อาจเป็นไปได้ว่าอาจไม่ได้เปิดใช้งาน! วิธีเปิดใช้งานหรือปิดใช้งาน "กลับสู่ SharePoint แบบคลาสสิก" ใน SharePoint Online

โปรดทราบว่าสคริปต์นี้จะไม่แปลงหน้าแรกของไซต์ทีมแบบคลาสสิกของคุณให้เป็นแบบสมัยใหม่ คุณต้องสร้างเพจใหม่ที่ทันสมัยและตั้งเป็นโฮมเพจ!

PowerShell เพื่อเปลี่ยนจากประสบการณ์แบบคลาสสิกไปสู่ประสบการณ์สมัยใหม่

หากต้องการเปิดใช้งานประสบการณ์สมัยใหม่ เราต้องปิดใช้งานฟีเจอร์ประสบการณ์แบบคลาสสิก และเมื่อต้องการปิดใช้งานประสบการณ์สมัยใหม่ เราควรเปิดใช้งานฟีเจอร์ประสบการณ์แบบคลาสสิกใน SharePoint Online อีกครั้ง สคริปต์ PowerShell นี้แบ่งออกเป็นสองฟังก์ชันที่แตกต่างกัน

  1. ตั้งค่าสถานะคุณสมบัติที่กำหนดเป็นเปิดใช้งานหรือปิดใช้งานในขอบเขตที่กำหนด เช่น ไซต์หรือเว็บ
  2. เปิดใช้งานคุณสมบัติที่เกี่ยวข้องในขอบเขตที่เหมาะสมเพื่อตั้งค่าประสบการณ์ UI

คุณสามารถใช้สคริปต์ PowerShell นี้เพื่อเปิดหรือปิดใช้งานประสบการณ์สมัยใหม่ในระดับไซต์คอลเลกชันหรือระดับไซต์ สคริปต์นี้จะตั้งค่าประสบการณ์การใช้งานสมัยใหม่หรือประสบการณ์คลาสสิกบนออบเจ็กต์: รายการและไลบรารี (หากการตั้งค่าประสบการณ์รายการคือ: “ประสบการณ์เริ่มต้นสำหรับไซต์”) เนื้อหาของไซต์ การใช้งานไซต์ ถังรีไซเคิล ฯลฯ


#Load SharePoint CSOM Assemblies
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll"
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"

#Function to Enable or Disable Feature in SharePoint Online
Function Set-SPOFeatureStatus
{
    [CMDLetBinding()]
    Param
    (
        [Parameter(Mandatory=$True)][Microsoft.SharePoint.Client.ClientContext]$Context,
        [Parameter(Mandatory=$True)][GUID]$FeatureGUID,
        [Parameter(Mandatory=$True)][ValidateSet('Site','Web')][String]$Scope,
        [Parameter(Mandatory=$True)][ValidateSet('Enable','Disable')][String]$Status
    )
    If($Scope -eq "Site")
    {
        #Get the Site
        $Site = $Context.Site
        #Get the Feature Status
        $FeatureStatus =  $Site.Features.GetById($FeatureGuid)
        $FeatureStatus.Retrieve("DefinitionId")
        $Context.Load($FeatureStatus)
        $Context.ExecuteQuery()

        If($Status -eq "Enable")
        {
            #Activate the feature if its not enabled already
            If($FeatureStatus.DefinitionId -eq $null)
            {
                #Enable the Feature
                $Site.Features.Add($FeatureGuid, $True, [Microsoft.SharePoint.Client.FeatureDefinitionScope]::None) | Out-Null
                $Context.ExecuteQuery()
                Write-host -f Green "`tFeature has been Enabled at Site Level!"
            }
            Else
            {
                Write-host -f Yellow "`tFeature is Already Enabled at Site Level!"
            }
        }
        Elseif($Status -eq "Disable")
        {
            #De-Activate the feature if its enabled already
            If($FeatureStatus.DefinitionId -ne $null)
            {
                #Disable feature
                $Site.Features.Remove($FeatureGuid, $True) | Out-Null
                $Context.ExecuteQuery()
                Write-host -f Green "`tFeature has been Disabled at Site Level!"
            }
            Else
            {
                Write-host -f Yellow "`tFeature is Already Disabled at Site Level!"
            }
        }
    }
    ElseIf($Scope -eq "Web")
    {
        #Get the web
        $Web = $Context.Web
        #Get the Feature Status
        $FeatureStatus =  $Web.Features.GetById($FeatureGUID)
        $FeatureStatus.Retrieve("DefinitionId")
        $Context.Load($FeatureStatus)
        $Context.ExecuteQuery()
    
        If($Status -eq "Enable")
        {
            #Activate the feature if its not enabled already
            If($FeatureStatus.DefinitionId -eq $null)
            {
                #Enable Feature
                $Web.Features.Add($FeatureGUID, $True, [Microsoft.SharePoint.Client.FeatureDefinitionScope]::None)| Out-Null
                $Context.ExecuteQuery()
                Write-host -f Green "`tFeature has been Enabled at Web Level!"
            }
            Else
            {
                Write-host -f Yellow "`tFeature is Already Enabled at Web Level!"
            }
        }
        ElseIf($Status -eq "Disable")
        {
            #De-Activate the feature if its enabled already
            If($FeatureStatus.DefinitionId -ne $null)
            {
                #Disable Classic Experience feature, which Enables Modern UI
                $Web.Features.Remove($FeatureGUID, $True) | Out-Null                
                $Context.ExecuteQuery()
                Write-host -f Green "`tFeature has been Disabled at Web Level!"   
            }
            Else
            {
                Write-host -f Yellow "`tFeature is Already Disabled at Web Level!"
            }
        }
    }
}

#Function to set UI  experience to Modern or Classic at Site or Web Level
Function Set-SPOUIExperience
{
    [CMDLetBinding()]
    Param
    (
        [String]$SiteURL, 
        [Parameter(Mandatory=$True)][ValidateSet('Modern','Classic')][String]$Experience,
        [Parameter(Mandatory=$True)][ValidateSet('Site','Web')][String]$Scope
    )

    Try {
        #Setup the context
        $Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
        $Ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.Username, $Cred.Password)

        #Site Scoped Feature "EnableDefaultListLibrarExperience" - Classic Experience
        $SiteFeatureGuid = New-Object System.Guid "E3540C7D-6BEA-403C-A224-1A12EAFEE4C4"
        
        #Web Scoped Feature "EnableDefaultListLibrarExperience" - Classic Experience
        $WebFeatureGUID = New-Object System.Guid "52E14B6F-B1BB-4969-B89B-C4FAA56745EF" 

        #Enable or Disable Modern Experience based on the parameters
        If($Scope -eq "Site")
        {
            #Get the web
            $Web = $Ctx.Web
            $Ctx.Load($Web)
            $Ctx.ExecuteQuery()

            If($Experience -eq "Modern")
            { 
                #Disable Classic Experience feature at site level
                Write-host -f Green "Enabling Modern Experience at the Site Collection by Disabling Classic UI Feature..."
                Set-SPOFeatureStatus -Context $Ctx -FeatureGUID $SiteFeatureGuid -Scope Site -Status Disable

                #Disable Classic Experience feature at web level
                Set-SPOUIExperience $Web.URL -Experience $Experience -Scope Web

                #Process each subsite in the site
                $Subsites = $Web.Webs
                $Ctx.Load($Subsites)
                $Ctx.ExecuteQuery()        
                Foreach ($SubSite in $Subsites)
                {
                    #Call the function Recursively
                    Set-SPOUIExperience $SubSite.URL -Experience $Experience -Scope Web
                }
            }
            ElseIf($Experience -eq "Classic")
            {
                #Enable Classic Experience feature at site level
                Write-host -f Green "Enabling Classic Experience at the Site Collection..."
                Set-SPOFeatureStatus -Context $Ctx -FeatureGUID $SiteFeatureGuid -Scope Site -Status Enable                
                
                #Enable Classic Experience feature at web level
                Set-SPOUIExperience $Web.URL -Experience $Experience -Scope Web

                #Process each subsite in the site
                $Subsites = $Web.Webs
                $Ctx.Load($Subsites)
                $Ctx.ExecuteQuery()        
                Foreach ($SubSite in $Subsites)
                {
                    #Call the function Recursively
                    Set-SPOUIExperience $SubSite.URL -Experience $Experience -Scope Web
                }
            }
        }
        ElseIf($Scope -eq "Web")
        {
            If($Experience -eq "Modern")
            {
                #Disable Classic Experience
                Write-host -f Green "Enabling Modern Experience at the Web $($SiteURL) by Disabling Classic UI Feature..."
                Set-SPOFeatureStatus -Context $Ctx -FeatureGUID $WebFeatureGUID -Scope Web -Status Disable                
            }
            ElseIf($Experience -eq "Classic")
            {
                #Enable Classic Experience
                Write-host -f Green "Enabling Classic Experience at the Web $($SiteURL)"
                Set-SPOFeatureStatus -Context $Ctx -FeatureGUID $WebFeatureGUID -Scope Web -Status Enable
            }
        }
    }
    Catch {
        write-host -f Red "Error:" $_.Exception.Message
    }
}

#Set Variable
$SiteURL = "https://crescent.sharepoint.com/sites/marketing"

#Get Credentials to connect
$Cred = Get-Credential

#Call the function to set UI experience
Set-SPOUIExperience -SiteURL $SiteURL -Experience Modern -Scope Site

เมื่อคุณเปิดใช้งานคุณลักษณะระดับไซต์ ไซต์ใหม่ที่คุณสร้างจะเป็นไปตามชุดประสบการณ์ UI ในทำนองเดียวกัน คุณลักษณะระดับเว็บจะกำหนดประสบการณ์ UI บนเว็บที่มีอยู่

จะเปลี่ยนมุมมองคลาสสิกเป็นมุมมองสมัยใหม่ใน SharePoint Online ได้อย่างไร

คุณสามารถเรียกใช้ฟังก์ชันด้วยพารามิเตอร์ที่เกี่ยวข้องเพื่อเปลี่ยนมุมมองคลาสสิกเป็นมุมมองสมัยใหม่ในไซต์ SharePoint เช่น.,


Set-SPOUIExperience -SiteURL $SiteURL -Experience Modern -Scope Site

สคริปต์ PowerShell นี้จะเปลี่ยนประสบการณ์ UI จากมุมมองคลาสสิกเป็นมุมมองสมัยใหม่สำหรับรายการและไลบรารีทั้งหมดในไซต์คอลเลกชันที่กำหนด อย่างไรก็ตาม การตั้งค่าขั้นสูงในระดับแต่ละรายการและไลบรารีสามารถแทนที่การตั้งค่าทั่วทั้งไซต์ได้ ใช้สคริปต์นี้เพื่ออัปเดตการตั้งค่าไลบรารี: SharePoint Online: วิธีเปลี่ยน UI รายการเป็นประสบการณ์สมัยใหม่ได้อย่างไร

ในทำนองเดียวกัน คุณสามารถสลับกลับไปเป็นประสบการณ์แบบคลาสสิกได้จากมุมมองสมัยใหม่ในไซต์ SharePoint Online ด้วย:


Set-SPOUIExperience -SiteURL $SiteURL -Experience Classic -Scope Site

PnP PowerShell เพื่อปิดการใช้งานประสบการณ์แบบคลาสสิกและเปิดใช้งาน UI สมัยใหม่สำหรับไซต์

PnP PowerShell ทำให้การเปลี่ยนไซต์คลาสสิกให้กลายเป็นไซต์สมัยใหม่ง่ายขึ้นมาก


#Parmeter
$SiteURL = "https://crescent.sharepoint.com/sites/Marketing/townhall"

#Connect to Site
Connect-PnPOnline -Url $SiteURL -Interactive

#Disable Modern UI Blocking Features at both Site and Web Level
Disable-PnPFeature -Identity "E3540C7D-6BEA-403C-A224-1A12EAFEE4C4" -Scope Site
Disable-PnPFeature -Identity "52E14B6F-B1BB-4969-B89B-C4FAA56745EF" -Scope Web

โปรดทราบว่าคุณต้องปิดการใช้งานคุณสมบัตินี้ในระดับไซต์ด้วย แม้ว่าคุณต้องการปิดการใช้งาน UI แบบคลาสสิกที่ไซต์ย่อยใดไซต์หนึ่งก็ตาม! (เนื่องจากฟีเจอร์ที่กำหนดขอบเขตที่ไซต์คอลเลกชันนั้นสืบทอดมาจากไซต์ย่อย!) นอกจากนี้ สคริปต์นี้จะไม่เปลี่ยนหน้า SharePoint แบบคลาสสิกใดๆ (รวมถึงโฮมเพจ หน้าการประกาศ หน้า wiki หน้า web part และไลบรารีหน้าไซต์) เป็นหน้าสมัยใหม่ เมื่อต้องการรับโฮมเพจสมัยใหม่ คุณต้องใช้: ฉันจะแปลงเพจคลาสสิกเป็นเพจสมัยใหม่ใน SharePoint Online ได้อย่างไร

คำถามที่พบบ่อย:

ฉันจะเปลี่ยนไซต์สมัยใหม่เป็นไซต์คลาสสิกใน SharePoint Online ได้อย่างไร

ถ้าคุณต้องการกลับไปใช้ประสบการณ์ผู้ใช้แบบคลาสสิกจากไซต์ทีมสมัยใหม่ ให้ใช้: SharePoint Online สลับไปยังมุมมองแบบคลาสสิก คุณยังคงสร้างไซต์ใหม่ได้โดยใช้เทมเพลตไซต์แบบคลาสสิก

ฉันจะเปลี่ยนไซต์รากเป็นไซต์การสื่อสารสมัยใหม่ใน SharePoint Online ได้อย่างไร

หากต้องการเปลี่ยนไซต์ราก (หรือไซต์ทีม) เป็นไซต์การติดต่อสื่อสาร ให้ใช้ cmdlet "Enable-SPOCommSite" คุณยังสามารถแทนที่ไซต์ SharePoint แบบคลาสสิกด้วยไซต์สมัยใหม่ในศูนย์การจัดการ SharePoint
ข้อมูลเพิ่มเติม: แปลงไซต์รากเป็นไซต์การติดต่อสื่อสารใน SharePoint Online

ฉันจะสร้างเพจสมัยใหม่บนไซต์ SharePoint Classic ได้อย่างไร

เมื่อต้องการสร้างหน้าสมัยใหม่ในไซต์ Classic SharePoint Online: เปิดใช้งานฟีเจอร์ขอบเขตเว็บ "หน้าไซต์" ก่อน เมื่อคุณเปิดใช้งานฟีเจอร์นี้แล้ว คุณจะพบ “เพจ” ที่แสดงอยู่บนหน้าเนื้อหาของไซต์หรือในไลบรารี “หน้าไซต์” ของไซต์ของคุณ
ข้อมูลเพิ่มเติม: SharePoint Online เพิ่มเพจสมัยใหม่ลงในไซต์แบบคลาสสิก

บทความที่เกี่ยวข้อง