• 批量上传用户头像


    【客户需求】

    客户环境是SharePoint 2016

    客户希望批量把本地用户头像图片上传到SharePoint网站对应的用户头像上

    【解决办法】

    方法一:

    发头像批量上传到AD中,再通过SharePoint2016 的MIM同期头像信息。

    方法二:

    使用PowerShell手动上传头像

    1.将头像图片放到SharePoint服务器上

    2.在该服务器的IIS里创建web site用于http访问头像

    3.创建CSV文件,写入头像图片与ad用户关系

    4.执行以下powershell

    [void][system.reflection.assembly]::loadwithpartialname("Microsoft.Office.Server.UserProfiles");
    $csvFile = "C:1photo.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.执行下面的PowerShell,用于将上传的头像创建3个不同尺寸头像,优化显现。

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

    6.执行后查看效果

     

  • 相关阅读:
    oracle--角色权限
    oracle--权限的传递
    oracle--少见操作、如何调整dos窗口大小、字符集设置
    oracle--对象权限
    oracle-系统权限管理
    IOS-swift5.1快速入门之旅
    oracle--用户区别sys和system
    JSP基础--EL表达式
    JSP基础--javaBean
    hdu_A Walk Through the Forest ——迪杰特斯拉+dfs
  • 原文地址:https://www.cnblogs.com/jindahao/p/8939815.html
Copyright © 2020-2023  润新知