• SharePoint 2013技巧分享系列


    在“SharePoint 2013技巧分享系列 - Active Directory同步显示用户照片”文中介绍了如何同步Active Directory显示用户照片,但是同步完成后,用户照片尺寸和清晰度都不是非常理想。本文将介绍如何同步Exchange Server显示高清用户照片。

    原理

    与SharePoint Server 2010相似, 在SharePoint Server 2013中存在一个用户照片的目录。当SharePoint启用Exchange照片同步时, SharePoint将使用Exchange Server 2013 作为照片存取目录, 而SharePoint本地照片目录将被屏蔽,也就是说,设置SharePoint-Exchange照片同步后,将不允许用户通过SharePoint修改其头像照片。在Central Administration - User Profile - Manage User Profiles中可以看到Picture属性显示“You can't change this person's photo because it is synchronized with Microsoft Exchange.". 

    需要注意的是,在进行同步设置时,要对Exchange Server进行简单的配置,并且需要重新启动IIS。 而在SharePoint 2013中需要配置相关权限和服务,使SharePoint 2013能够连接Exchange Server并获取用户数据。

    环境实例

    为了避免误解,这里我们实现定义一些环境配置,方便在详细步骤中调用:

    1. SharePoint Server 2013 (http://people), 需要添加Alternate Access映射https://people. 该连接指向My Site。 

    2. Exchange 2013 Client Access server (FQDN) http://e15fe.test.com。

    3. Exchange 2013 Mailbox server (FQDN) http://e15be.test.com。 确认测试用户帐号已经创建, 例如 kevin@test.com。 另外确认高清照片已经上传。

    4. 添加DNS record, 使autodiscover.test.com指向http://e15fe.test.com。

    步骤

    确认以上所有配置后,我们将进行以下几个步骤的配置 。

    第一步,添加Exchange 2013 Autodiscover服务,在Exchange Management Shell command中运行以下命令,

    Get-ClientAccessServer | Set-ClientAccessServer -AutoDiscoverServiceInternalUri https://autodiscover.test.com/autodiscover/autodiscover.xml

    第二步, SharePoint 2013 使用外部连接EWS和ECP读取Exchange 2013 用户照片数据。 现在我们需要使用Exchange Management Shell command运行,

    Get-WebServicesVirtualDirectory | Set-WebServicesVirtualDirectory –InternalUrl https://e15fe.test.com/ews/exchange.asmx –ExternalUrl https://e15fe.test.com/ews/exchange.asmx

    Get-EcpVirtualDirectory | Set-EcpVirtualDirectory –InternalUrl https://e15fe.test.com/ecp –ExternalUrl https://e15fe.test.com/ecp

    第三步,完成以上Exchange server配置后,需要在SharePoint 2013安装Exchange Web Services Managed API v2.0,并且将Microsoft.Exchange.WebServices.dll载入到GAC中。 这一步骤我们需要使用.NET 4中的命令GacUtil,所以,在进行这一步骤前,请确认.Net 4.0 SDK已经安装在服务器上。完成安装后,在PowerShell中运行以下命令载入Microsoft.Exchange.WebServices.dll。 载入完成后,需要重新启动IIS。

    Set-location "C:Program FilesMicrosoftExchangeWeb Services2.0"

    [System.Reflection.Assembly]::Load("System.EnterpriseServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")

    $publish = New-Object System.EnterpriseServices.Internal.Publish

    $publish.GacInstall("c:Program FilesMicrosoftExchangeWeb Services2.0Microsoft.Exchange.WebServices.dll")

    iisreset

    第四步,在SharePoint 2013中配置S2SOAuth,使用SharePoint 2013 Management Shell command运行以下命令:

    New-SPTrustedSecurityTokenIssuer -name "Exchange" -MetadataEndPoint "https://email.test.com/autodiscover/metadata/json/1"

    $sts=Get-SPSecurityTokenServiceConfig

    $sts.HybridStsSelectionEnabled = $true

    $sts.AllowMetadataOverHttp = $false

    $sts.AllowOAuthOverHttp = $false

    $sts.Update()

    $exchange=Get-SPTrustedSecurityTokenIssuer "Exchange"

    $app=Get-SPAppPrincipal -Site http://people -NameIdentifier $exchange.NameId

    $site=Get-SPSite http://people

    Set-SPAppPrincipalPermission -AppPrincipal $app -Site $site.RootWeb -Scope sitesubscription -Right fullcontrol -EnableAppOnlyPolicy

    第五步, 在Exchange server中配置S2SOAuth,在Exchange Management Shell中运行以下命令

    cd Program FilesMicrosoftExchange ServerV15Scripts>

    .Configure-EnterprisePartnerApplication.ps1 -AuthMetadataUrl https://people/_layouts/15/metadata/json/1 -ApplicationType sharepoint

    完成以上命令后,需要重启IIS,

    iisreset e15fe

    iisreset e15be

    第六步,配置SharePoint 2013 和Exchange server照片同步

    $wa = Get-SPWebApplication http://people

    $wa.Properties["ExchangeAutodiscoverDomain"] = "email.test.com"

    $wa.UserPhotoImportEnabled = $true

    $wa.UserPhotoErrorExpiration = 1.0

    $wa.UserPhotoExpiration = 6.0

    $wa.Update()

    完成以上步骤后,使用测试帐户登陆进入http://people,刷新后即可从Exchange服务器获取高清用户照片。

    需要注意的是,如果仍旧显示Active Directory小照片,可以在Central Administration - User Profile Service - Manage User Properties中,编辑Picture属性,删除其中Active Directory映射的Property Mapping for Synchronization,然后”Start Full Profile Synchronization“即可。

    对比显示结果:

    同步前

    同步后

    在http://people中大照片显示对比更加明显,这里就不再上传了。

    如果你有更好的建议和方法,欢迎留言讨论。

  • 相关阅读:
    git使用教程PDF版
    Everything(一款用于检索硬盘文件的工具)
    Animate.css(一款有意思的CSS3动画库)
    bootstrap3中container与container_fluid的区别
    河北省重大技术需求征集系统设计(七稿)第九天
    河北省重大技术需求征集系统设计(七稿)第八天
    河北省重大技术需求征集系统设计(七稿)第七天
    河北省重大技术需求征集系统设计(七稿)第六天
    河北省重大技术需求征集系统设计(七稿)第五天
    河北省重大技术需求征集系统设计(七稿)第四天
  • 原文地址:https://www.cnblogs.com/jv9/p/3987530.html
Copyright © 2020-2023  润新知