Bulk upload user avatars

【client needs】

Customer environment is SharePoint 2016

The customer wants to upload the local user avatar pictures to the corresponding user avatars on the SharePoint website in batches

【Solution】

method one:

Send avatars and upload them to AD in batches, and then use the MIM of SharePoint2016 to synchronize avatar information.

Method Two:

Manually upload avatars using PowerShell

1. Put the avatar picture on the SharePoint server

2. Create a web site in the server's IIS for http access to the avatar

3. Create a CSV file, write the relationship between the avatar picture and the ad user

4. Execute the following powershell

[void][system.reflection.assembly]::loadwithpartialname("Microsoft.Office.Server.UserProfiles");
$csvFile = "C:\1\photo.csv";
$MySiteUrl = "http://sp2016-3/my";
$site = Get-SPSite $MySiteUrl;
$context = Get-SPServiceContext $site;
$profileManager = New-Object Microsoft.Office.Server.UserProfiles.UserProfileManager($context);
$csv = import-csv -path $csvFile;
foreach ($line in $csv)
{
$user_name = "contoso\" + $line.domain_user_name;
$up = $profileManager.GetUserProfile($user_name);
if($up)
{
$up["PictureURL"].Value = $line.emp_id;
$up.Commit();
write-host $user_name,"--->",$up.DisplayName,"--->",$line.emp_id;
$up = $null;
}
}

  

 5. Execute the following PowerShell to create 3 different sizes of avatars from the uploaded avatars for optimized display.

 Update-SPProfilePhotoStore -MySiteHostLocation http://sp2016-3/my

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324814341&siteId=291194637