SharePoint Online: คัดลอก/ย้ายผู้ใช้จากกลุ่มหนึ่งไปยังอีกกลุ่มหนึ่ง
ความต้องการ: ย้ายผู้ใช้จากกลุ่มหนึ่งไปยังอีกกลุ่มหนึ่งใน SharePoint Online
จะคัดลอกหรือย้ายผู้ใช้ระหว่างกลุ่ม SharePoint Online ได้อย่างไร
คุณจำเป็นต้องคัดลอกผู้ใช้จากกลุ่มหนึ่งไปยังอีกกลุ่มหนึ่งใน SharePoint Online หรือไม่ บางทีคุณอาจเพิ่งสร้างกลุ่มใหม่และจำเป็นต้องเติมผู้ใช้จากกลุ่มที่มีอยู่ บางทีคุณอาจต้องการย้ายผู้ใช้จากกลุ่มหนึ่งไปยังอีกกลุ่มหนึ่ง ไม่ว่าจะด้วยเหตุผลใดก็ตาม มีสองสามวิธีที่คุณสามารถทำได้ บทความนี้จะแสดงวิธีการคัดลอกผู้ใช้จากกลุ่มหนึ่งไปยังอีกกลุ่มหนึ่งโดยใช้ PowerShell และวิธีดำเนินการด้วยตนเองใน SharePoint Online มาเริ่มกันเลย!
ไม่มีวิธีโดยตรงในการคัดลอกหรือย้ายผู้ใช้ระหว่างกลุ่ม SharePoint Online แต่คุณสามารถทำได้โดยทำตามขั้นตอนด้านล่าง:
- คลิกที่เกียร์การตั้งค่า >> การตั้งค่าไซต์
- คลิกที่ "บุคคลและกลุ่ม" ใต้กลุ่ม "ผู้ใช้และการอนุญาต"
เลือกชื่อกลุ่มแหล่งที่มาจากการนำทางด้านซ้าย >> เลือกผู้ใช้ทั้งหมดโดยทำเครื่องหมายที่ช่องทำเครื่องหมายในส่วนหัว >> คลิกที่ "ผู้ใช้อีเมล" จากเมนู "การดำเนินการ" ซึ่งจะเปิดโปรแกรมรับส่งเมลเริ่มต้นพร้อมกับผู้ใช้ทั้งหมดในกลุ่ม คัดลอกมัน!
- นำทางไปยังกลุ่มปลายทางในไซต์ SharePoint Online >> คลิกที่ “เพิ่มผู้ใช้และวางอีเมลที่คัดลอกเหล่านั้น คุณสามารถลบออกจากกลุ่มแหล่งที่มาได้หากเป็น "ย้าย"
วิธีการข้างต้นอาจทำได้ง่ายกว่าเมื่อคุณต้องคัดลอกหรือย้ายผู้ใช้บางรายระหว่างกลุ่ม SharePoint จะดีกว่าไหมถ้าใช้วิธีแบบสคริปต์เพื่อคัดลอกผู้ใช้หลายรายเป็นกลุ่ม
SharePoint Online: ย้ายผู้ใช้จากกลุ่มหนึ่งไปยังอีกกลุ่มหนึ่งโดยใช้ PowerShell
ต่อไปนี้คือวิธีที่คุณสามารถย้ายผู้ใช้จากกลุ่มหนึ่งไปยังอีกกลุ่มหนึ่งใน SharePoint Online:
#Config Variables
$SiteURL = "https://crescent.sharepoint.com/sites/marketing"
$SourceGroupName = "Marketing Team"
$DestinationGroupName = "Marketing Managers"
#Connect to PnP Online
Connect-PnPOnline -Url $SiteURL -Interactive
#Get Members of the Source Group
$SourceGroup = Get-PnPGroup -Identity $SourceGroupName | Select-Object Users
#Add users to destination group
Foreach ($User in $SourceGroup.Users)
{
#Frame User ID
$UserID = "i:0#.f|membership|"+$User.Email
#Add user to Group
Add-PnPGroupMember -LoginName $UserID -Identity $DestinationGroupName
#Remove user from source group
Remove-PnPGroupMember -LoginName $UserID -Identity $SourceGroupName
Write-host "User Moved :"$User.Email
}
คุณสามารถใส่เครื่องหมายความคิดเห็นที่ “Remove-PnPGroupMember” (บรรทัด#20) เพื่อทำการคัดลอกผู้ใช้ระหว่างกลุ่ม
PowerShell เพื่อย้ายผู้ใช้ระหว่างกลุ่มจากไซต์หนึ่งไปยังอีกไซต์หนึ่ง
แล้วการย้ายผู้ใช้ระหว่างกลุ่มบนเว็บไซต์ต่างๆล่ะ?
#Parameters
$SourceSiteURL = "https://crescent.sharepoint.com/sites/marketing"
$DestinationSiteURL = "https://crescent.sharepoint.com/sites/Purchase"
$SourceGroupName = "Marketing Members"
$DestinationGroupName = "Purchase Members"
Try {
#Connect to the Source and Destination Sites
$SourceSite = Connect-PnPOnline -Url $SourceSiteURL -Interactive -ReturnConnection
$DestinationSite = Connect-PnPOnline -Url $DestinationSiteURL -Interactive -ReturnConnection
#Get Members of the Source Group
$SourceGroup = Get-PnPGroup -Connection $SourceSite -Identity $SourceGroupName | Select-Object Users
#Add users to destination group
Foreach ($User in $SourceGroup.Users)
{
#Resolve the User
$ResolvedUser = Get-PnPUser -Connection $DestinationSite | Where-Object LoginName -eq $User.LoginName
If($ResolvedUser -eq $null) {
$ResolvedUser = New-PnPUser -LoginName $User.LoginName -Connection $DestinationSite
}
#Add user to Group
Add-PnPGroupMember -Connection $DestinationSite -LoginName $User.LoginName -Identity $DestinationGroupName
#Remove user from source group
Remove-PnPGroupMember -Connection $SourceSite -LoginName $User.LoginName -Identity $SourceGroupName
Write-host "User Moved :"$User.LoginName
}
}
Catch {
write-host -f Red "`tError:" $_.Exception.Message
}
โปรดทราบว่า หากคุณเปิดใช้งานผู้ใช้ภายนอกสำหรับไซต์ต้นทาง คุณต้องดำเนินการดังกล่าวบนไซต์ปลายทางด้วย (ซึ่งชัดเจนใช่ไหม)
ห่อ
โดยสรุป การคัดลอกผู้ใช้จากกลุ่มหนึ่งไปยังอีกกลุ่มหนึ่งใน SharePoint Online เป็นกระบวนการที่เรียบง่ายและมีประสิทธิภาพซึ่งสามารถช่วยให้องค์กรจัดการการเข้าถึงและสิทธิ์ของผู้ใช้ได้อย่างมีประสิทธิภาพ ด้วยการทำตามขั้นตอนที่อธิบายไว้ในบทความนี้ คุณสามารถถ่ายโอนผู้ใช้จากกลุ่มหนึ่งไปยังอีกกลุ่มหนึ่งใน SharePoint Online ได้อย่างง่ายดาย และให้แน่ใจว่าผู้ใช้มีสิทธิ์เข้าถึงทรัพยากรที่เหมาะสม
