zoukankan      html  css  js  c++  java
  • 批量上传用户头像

    【客户需求】

    客户环境是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.执行后查看效果

     

  • 相关阅读:
    diary and html 文本颜色编辑,行距和其它编辑总汇
    bash coding to changeNames
    virtualbox ubuntu 网络连接 以及 连接 secureCRT
    linux 学习6 软件包安装
    linux 学习8 权限管理
    vim 使用2 转载 为了打开方便
    ubuntu
    linux 学习15 16 启动管理,备份和恢复
    linux 学习 14 日志管理
    linux 学习 13 系统管理
  • 原文地址:https://www.cnblogs.com/jindahao/p/8939815.html
Copyright © 2011-2022 走看看