zoukankan      html  css  js  c++  java
  • SharePoint Online:使用PowerShell获取所有用户配置文件

    如何在SharePoint Online中获取用户配置文件?
    SharePoint中的用户配置文件是存储有关用户信息的中央位置。它启用“我的网站”,社交功能并在租户中的多个网站之间共享配置文件。要在SharePoint Online中获取所有用户配置文件,请执行以下操作:

    • 登录到SharePoint Online Admin >>单击左侧导航栏中的“更多功能” >>单击“用户配置文件”旁边的“打开”按钮。
      通过powershell在线获取Sharepoint中的所有用户配置文件
    • 在“用户个人资料”页面中,单击“人员”选项卡下的“管理用户个人资料”。使用搜索获取用户的用户资料。
    • SharePoint Online在线获取所有用户配置文件的功能

    此页面可帮助我们逐一获取各个用户的个人资料和属性。现在,让我们看看如何使用PowerShell在SharePoint Online中获取所有用户配置文件。

    SharePoint Online:使用PowerShell获取所有用户配置文件
    让我们使用PowerShell在SharePoint Online中获取所有用户配置文件

    #Load SharePoint CSOM Assemblies
    Add-Type -Path "C:Program FilesCommon FilesMicrosoft SharedWeb Server Extensions16ISAPIMicrosoft.SharePoint.Client.dll"
    Add-Type -Path "C:Program FilesCommon FilesMicrosoft SharedWeb Server Extensions16ISAPIMicrosoft.SharePoint.Client.Runtime.dll"
    Add-Type -Path "C:Program FilesCommon Filesmicrosoft sharedWeb Server Extensions16ISAPIMicrosoft.SharePoint.Client.UserProfiles.dll"
      
    #Variables
    $AdminSiteUrl = "https://crescent-admin.sharepoint.com"
    $CSVPath = "C:TempUserProfiles.csv"
     
    #Get Credentials
    $Cred = Get-Credential
     
    #Connect to AzureAD
    Connect-AzureAD -Credential $Cred
     
    #Get All Users from AzureAD
    $AllUsers = Get-AzureADUser -All:$True
    Write-host "Total Number of User Profiles Found:"$AllUsers.Count
     
    #Setup the context
    $Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.Username, $Cred.Password)
    $Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($AdminSiteURL)
    $Ctx.Credentials = $Credentials
     
    #Collect User data
    $PeopleManager = New-Object Microsoft.SharePoint.Client.UserProfiles.PeopleManager($Ctx)
    $UserDataCollection = @()
     
    $Counter = 1
    ForEach($User in $AllUsers)
    {
        #Get User Profile
        $UserProfile = $PeopleManager.GetPropertiesFor(('i:0#.f|membership|'+$User.UserPrincipalName))
        $Ctx.Load($UserProfile)
        $Ctx.ExecuteQuery()
     
        Write-Progress -Activity "Extracting User Profile Data..." -Status "Getting User Profile $Counter of $($AllUsers.Count)" -PercentComplete (($Counter / $AllUsers.Count)  * 100)
        #Get User Profile Data
        $UserData = New-Object PSObject
        ForEach($Key in $UserProfile.UserProfileProperties.Keys)
        {  
            $UserData | Add-Member NoteProperty $Key($UserProfile.UserProfileProperties[$Key])
        }
        $UserDataCollection += $UserData
        $Counter++
    }
     
    #Export Data to CSV File
    $UserDataCollection | Export-Csv -Path $CSVPath -NoTypeInformation


    此PowerShell在SharePoint Online中获取所有用户配置文件和属性。

    在线sharepoint获取所有用户配置文件Powershell
  • 相关阅读:
    Android Packaging Problem
    Dedecms中{dede:type}标签支持调用父级栏目名称
    DeDecms远程写入漏洞webshell (dedecms漏洞)
    Dedecms 目标仿站的学习视频
    关于前端JS走马灯(marquee)总结
    浏览器端如何使用VConsole.js调试代码?
    Firefox中input元素,不能重新获取焦点函数focus()
    Centos7 systemctl添加自定义系统开机服务
    织梦cms 内容模型 option下拉框 value 分离
    wdcp如何添加反向代理功能
  • 原文地址:https://www.cnblogs.com/Javi/p/13303814.html
Copyright © 2011-2022 走看看