SharePoint Online: สร้างกลุ่มใหม่ใน Term Store โดยใช้ PowerShell
ความต้องการ: สร้างกลุ่มใหม่ใน SharePoint Online Term Store
จะสร้างกลุ่มคำศัพท์ใหม่ใน SharePoint Online ได้อย่างไร
คุณเคยจำเป็นต้องสร้างกลุ่มใหม่ใน Term Store สำหรับ SharePoint Online หรือไม่? ในโพสต์นี้ เราจะอธิบายขั้นตอนที่จำเป็นในการสร้างกลุ่มใหม่ใน Term Store โดยใช้ศูนย์การจัดการ SharePoint นอกจากนี้เรายังจัดเตรียมสคริปต์สคริปต์บางตัวที่คุณสามารถใช้เป็นจุดเริ่มต้นสำหรับการสร้างกลุ่มคำศัพท์ของคุณใน SharePoint Online
เมื่อต้องการสร้างกลุ่มใหม่ในที่เก็บคำ SharePoint Online ให้ทำตามขั้นตอนเหล่านี้:
- นำทางไปยังไซต์ศูนย์การจัดการ SharePoint ของคุณ (เช่น https://yourdomain-admin.sharepoint.com)
- ขยาย "บริการเนื้อหา" และคลิกลิงก์ "ที่เก็บคำ" บนเมนูการนำทางด้านซ้าย
คลิกที่จุดแนวตั้งสามจุดเล็กๆ ในส่วนหัว "อนุกรมวิธาน" >> คลิกที่ "กลุ่มคำศัพท์ใหม่" จากตัวเลือกเมนู
-
พิมพ์ชื่อกลุ่มคำของคุณ กด Enter เพื่อสร้างกลุ่มคำให้เสร็จสมบูรณ์
เมื่อคุณสร้างกลุ่มใหม่แล้ว คุณสามารถเพิ่มชุดคำลงไปได้
PowerShell เพื่อเพิ่มกลุ่มคำศัพท์ใหม่ใน SharePoint Online:
หากคุณเหมือนกับผู้ดูแลระบบส่วนใหญ่ คุณจะต้องทำให้กระบวนการสร้างกลุ่มใหม่ใน Term Store ของคุณเป็นไปโดยอัตโนมัติ ฉันขอแสดงวิธีดำเนินการดังกล่าวด้วย 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"
#Variables for Processing
$AdminURL = "https://crescent-admin.sharepoint.com/"
$TermGroup ="Regions"
Try {
#Get Credentials to connect
$Cred = Get-Credential
$Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.Username, $Cred.Password)
#Setup the context
$Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($AdminURL)
$Ctx.Credentials = $Credentials
#Get the term store
$TaxonomySession=[Microsoft.SharePoint.Client.Taxonomy.TaxonomySession]::GetTaxonomySession($Ctx)
$TermStore =$TaxonomySession.GetDefaultSiteCollectionTermStore()
$Ctx.Load($TaxonomySession)
$Ctx.Load($TermStore)
$Ctx.ExecuteQuery()
#Check if the given group exists already
$TermGroups = $TermStore.Groups
$Ctx.Load($TermGroups)
$Ctx.ExecuteQuery()
$Group = $TermGroups | Where-Object {$_.Name -eq $TermGroup}
If(-not $Group)
{
#Create Term Group
$NewGroup = $TermStore.CreateGroup($TermGroup, [System.Guid]::NewGuid().toString())
$Ctx.Load($NewGroup)
$Ctx.ExecuteQuery()
Write-host "Term Group '$TermGroup' Created Successfully!" -ForegroundColor Green
}
else
{
Write-host "Term Group '$TermGroup' Exists Already!" -ForegroundColor Yellow
}
}
Catch {
write-host -f Red "Error Adding Term Group!" $_.Exception.Message
}
สร้างกลุ่มคำศัพท์ใน SharePoint Online โดยใช้ PnP PowerShell
ใน SharePoint Online ที่เก็บคำจะให้วิธีในการจัดการอนุกรมวิธานและข้อมูลเมตาทั่วทั้งไซต์และคอลเลกชันไซต์ต่างๆ การสร้างกลุ่มใหม่ในที่เก็บคำสามารถช่วยจัดระเบียบและจัดการชุดคำและเงื่อนไขได้ มาดูวิธีใช้ PnP PowerShell เพื่อสร้างกลุ่มใหม่ใน Term Store:
#Config Variables
$AdminCenterURL = "https://Crescent-admin.sharepoint.com"
$TermGroupName = "Regions"
$TermGroupDescription ="Term Group for Deals Pipeline Regions"
#Connect to PnP Online
Connect-PnPOnline -Url $SiteURL -Interactive
#Check if Term group exists
If(-Not(Get-PnPTermGroup -Identity $TermGroupName -ErrorAction SilentlyContinue))
{
#Create new group in Termstore
New-PnPTermGroup -Name $TermGroupName -Description $TermGroupDescription
Write-host -f Green "Term Group '$TermGroupName' created successfully!"
}
Else
{
Write-host -f Yellow "Term Group '$TermGroupName' already exists!"
}
โดยสรุป ที่เก็บคำสามารถเป็นเครื่องมือที่มีประโยชน์สำหรับการจัดการอนุกรมวิธานและข้อมูลเมตาสำหรับผู้เช่า SharePoint Online การสร้างกลุ่มใหม่ในที่เก็บคำใน SharePoint Online เป็นกระบวนการง่ายๆ ที่สามารถทำได้ในไม่กี่ขั้นตอนง่ายๆ ทำตามขั้นตอนที่อธิบายไว้ในบทความนี้ คุณสามารถสร้างกลุ่มใหม่ในที่เก็บคำ และเริ่มจัดระเบียบชุดคำและเงื่อนไขได้อย่างง่ายดาย

