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

SharePoint Online: วิธีเปลี่ยนชื่อคำศัพท์ใน Term Store โดยใช้ PowerShell ได้อย่างไร


ความต้องการ: เปลี่ยนชื่อคำศัพท์ใน SharePoint Online Term store โดยใช้ PowerShell

จะเปลี่ยนชื่อคำศัพท์ใน SharePoint Online Term Store ได้อย่างไร

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

เมื่อต้องการเปลี่ยนชื่อคำใน SharePoint Online Term Store คุณสามารถทำตามขั้นตอนเหล่านี้:

  1. เข้าสู่ระบบ SharePoint Online Admin Center >> คลิกที่ลิงก์ "Term store" ใต้ "Content Services" จากการนำทางด้านซ้าย
  2. ขยายกลุ่มคำ ชุดคำ และเลือกคำเป้าหมายเพื่อเปลี่ยนชื่อคำ
  3. คลิก "เปลี่ยนชื่อข้อกำหนด" จากแถบเครื่องมือ >> ป้อนชื่อใหม่สำหรับข้อกำหนดของคุณ

  4. กดบันทึกเพื่อยืนยันการเปลี่ยนแปลงของคุณ

SharePoint Online: อัปเดตชื่อข้อกำหนดโดยใช้ PowerShell

สคริปต์ 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"
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Taxonomy.dll"
   
#Set Variables
$SiteURL= "https://crescent-admin.sharepoint.com"
$TermGroupName = "Regions"
$TermSetName = "Africa"
$TermName="Namibia"

#Setup Credentials to connect
$Cred = Get-Credential
 
Try {
    #Setup the context
    $Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
    $Ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.UserName,$Cred.Password)
 
    #Get the Taxonomy Session and Term Store
    $TaxonomySession = [Microsoft.SharePoint.Client.Taxonomy.TaxonomySession]::GetTaxonomySession($Ctx)
    $TaxonomySession.UpdateCache()
    $Ctx.Load($TaxonomySession)
    $TermStore = $TaxonomySession.GetDefaultSiteCollectionTermStore()
    $Ctx.Load($TermStore)
    $Ctx.ExecuteQuery()

    #Get the Term Group    
    $TermGroup = $TermStore.Groups.GetByName($TermGroupName)
    $Ctx.Load($TermGroup) 

    #Get the Term Set
    $TermSet = $TermGroup.TermSets.GetByName($TermSetName)
    $Ctx.Load($TermSet)
    $Ctx.ExecuteQuery()

    #Get the term
    $Term = $TermSet.Terms.GetByName($TermName)
    $Ctx.Load($Term)
    $Ctx.ExecuteQuery()

    #Update Default Label of the Term
    $DefaultTermLabel = $Term.CreateLabel("Namibians", 1033, $True)

    #Add Synonyms
    $OtherTermLabel = $Term.CreateLabel("South West Africa", 1033, $False)
    $OtherTermLabel = $Term.CreateLabel("Suidwesafrica", 1033, $False)
    $Ctx.ExecuteQuery()

    Write-host -f Green "Term Name has been updated!"
}
Catch {
    write-host -f Red "Error: " $_.Exception.Message
}

PnP PowerShell เพื่อเปลี่ยนชื่อคำศัพท์ใน SharePoint Online

นี่คือสคริปต์ PnP PowerShell เพื่อเปลี่ยนชื่อสำหรับคำศัพท์:


#Parameters
$AdminCenterURL = "https://crescent-admin.sharepoint.com"

#Connect to Admin Center
Connect-PnPOnline -Url $AdminCenterURL -Interactive

#Rename Terms
Set-PnPTerm -Identity "Namibia" -TermSet "Africa" -TermGroup "Regions" -Name "Namibians"

โดยสรุป การเปลี่ยนชื่อคำในที่เก็บคำของ SharePoint Online เป็นกระบวนการที่ไม่ซับซ้อนผ่าน SharePoint Admin Center ด้วยสิทธิ์ผู้ดูแลระบบ Term store คุณสามารถเข้าถึง Term Store เปลี่ยนชื่อคำศัพท์เพื่อให้สะท้อนความหมายได้ดียิ่งขึ้น หรือเพื่อให้ข้อมูลเมตาของคุณอัปเดตอยู่เสมอ ด้วยการทำตามขั้นตอนที่อธิบายไว้ในบทช่วยสอนนี้ คุณสามารถเปลี่ยนชื่อคำศัพท์ในที่เก็บคำของ SharePoint Online ได้อย่างรวดเร็วและมีประสิทธิภาพ

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