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
  • 相关阅读:
    ‘Host’ is not allowed to connect to this mysql server
    centos7安装mysql
    further configuration avilable 不见了
    Dynamic Web Module 3.0 requires Java 1.6 or newer
    hadoop启动 datanode的live node为0
    ssh远程访问失败 Centos7
    Linux 下的各种环境安装
    Centos7 安装 python2.7
    安装scala
    Centos7 安装 jdk 1.8
  • 原文地址:https://www.cnblogs.com/Javi/p/13303814.html
Copyright © 2011-2022 走看看