SharePoint Online: รับ URL ของ OneDrive for Business ของผู้ใช้โดยใช้ PowerShell
ความต้องการ: PowerShell เพื่อรับ URL ของ OneDrive ใน SharePoint Online
จะรับ URL ของ OneDrive ของผู้ใช้ได้อย่างไร
ไซต์ของฉันใน SharePoint On-premises กลายเป็น OneDrive for Business ใน SharePoint Online OneDrive for Business คือพื้นที่จัดเก็บไฟล์บนระบบคลาวด์และแพลตฟอร์มการทำงานร่วมกันที่รวมเข้ากับ Office 365 โดยให้ตำแหน่งที่ตั้งแบบรวมศูนย์สำหรับการจัดเก็บและแชร์ไฟล์ ตลอดจนความสามารถในการทำงานร่วมกันและการสื่อสารแบบเรียลไทม์ โดยทั่วไป ไซต์ OneDrive จะอยู่ที่ URL: https://ผู้เช่า-my.sharepoint.com/personal/upn (เช่น https://crescent-my.sharepoint.com/personal/salaudeen_crescent_com หรือ https://crescent-my.sharepoint.com/personal/salaudeen_crescent_onmicrosoft_com)
เมื่อต้องการรับไซต์ OneDrive ของผู้ใช้ SharePoint Online ให้ทำตามขั้นตอนเหล่านี้:
- เข้าสู่ระบบ SharePoint Online Admin Center ที่ https://YourDomain-Admin.SharePoint.com
คลิกลิงก์ "โปรไฟล์ผู้ใช้" จากการนำทางด้านซ้าย >> คลิกลิงก์ "จัดการโปรไฟล์ผู้ใช้" ใต้กลุ่ม "บุคคล"
-
ค้นหาและเลือกโปรไฟล์ผู้ใช้ที่คุณต้องการเข้าถึง จากผลการค้นหา คลิกที่รายการเมนู "จัดการไซต์ส่วนบุคคล" จากเมนูบริบท
สิ่งนี้จะนำคุณไปสู่ไซต์ OneDrive! (ถ้าไซต์ OneDrive ถูกสร้างขึ้นแล้ว) มารับ URL ของ OneDrive for Business โดยใช้ PowerShell กัน
SharePoint Online: PowerShell เพื่อรับ URL ของ OneDrive
ลองสอบถามโปรไฟล์ผู้ใช้เพื่อดึง URL ไซต์ส่วนตัว ก่อนที่จะรันสคริปต์ อย่าลืมตั้งค่าชื่อผู้ใช้และพารามิเตอร์ URL ของไซต์ผู้ดูแลระบบ
#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.UserProfiles.dll"
#Set Config Parameters
$AdminSiteURL="https://crescent-admin.sharepoint.com"
$UserAccount="salaudeen@crescent.com"
Try {
#Setup Credentials to connect
$Cred= Get-Credential
#Setup the context
$Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($AdminSiteURL)
$Ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.Username, $Cred.Password)
#Get the User
$User = $Ctx.web.EnsureUser($UserAccount)
$Ctx.Load($User)
$Ctx.ExecuteQuery()
#Get OneDrive Site URL from User Profile
$PeopleManager = New-Object Microsoft.SharePoint.Client.UserProfiles.PeopleManager($Ctx)
$UserProfile = $PeopleManager.GetPropertiesFor($User.LoginName)
$Ctx.Load($UserProfile)
$Ctx.ExecuteQuery()
#Get the User Profile Property
Write-host $UserProfile.PersonalUrl
}
Catch {
write-host -f Red "Error Getting User Profile Properties!" $_.Exception.Message
}
สคริปต์นี้จะดึงข้อมูล URL ของ OneDrive (MySite) ของผู้ใช้ที่กำหนด เช่น https://crescent-my.sharepoint.com/personal/salaudeen_crescent_com/
PnP PowerShell เพื่อรับ URL ของ OneDrive ของผู้ใช้:
ในทำนองเดียวกัน คุณสามารถค้นหาโปรไฟล์ผู้ใช้และรับ URL ไซต์ของฉันด้วย PnP PowerShell เป็น
#Set Config Parameters
$AdminSiteURL="https://crescent-admin.sharepoint.com"
$UserAccount="salaudeen@crescent.com" #UPN
#Connect to the site
Connect-PnPOnline $AdminSiteURL -Interactive
#powershell to get onedrive for business url
Get-PnPUserProfileProperty -Account $UserAccount | Select PersonalUrl
นี่คืออีกโพสต์หนึ่งเพื่อรับคอลเลกชันไซต์ OneDrive ทั้งหมดของผู้เช่า: ค้นหาคอลเลกชันไซต์ OneDrive ทั้งหมดใน SharePoint Online โดยใช้ PowerShell
คำถามที่พบบ่อย:
ฉันจะค้นหา URL สำหรับ OneDrive for Business ของฉันได้อย่างไร
เปิด https://www.office.com/ และเข้าสู่ระบบด้วยบัญชีของคุณ >> คลิกที่ตัวเรียกใช้งานแอป >> คลิกที่ “OneDrive ” สิ่งนี้จะนำคุณไปยังหน้าหลักของ OneDrive for Business ของคุณ (ทางลัด URL: https://โดเมนของคุณ-my.sharepoint.com)
ข้อมูลเพิ่มเติม: วิธีเปิดไซต์ OneDrive for Business
ฉันจะแสดงรายการ URL ทั้งหมดของไซต์ OneDrive for Business ได้อย่างไร
เข้าสู่ระบบศูนย์การจัดการ Microsoft 365 ที่ https://admin.microsoft.com >> คลิกที่ “รายงาน” ในการนำทางด้านซ้าย >> คลิกที่ “การใช้งาน” >> ใต้ไฟล์ OneDrive คลิกที่ “ดูเพิ่มเติม” รายงานนี้จะแสดงรายการไซต์ OneDrive ทั้งหมดในองค์กรของคุณ คุณสามารถส่งออกข้อมูลรายงานเป็น CSV ได้เช่นกัน
ข้อมูลเพิ่มเติม: แสดงรายการ URL ของ OneDrive for Business ทั้งหมด

