Monday, June 15, 2015

How to import high resolution pictures to SharePoint using other links instead of thumbnailPhoto AD attribute?



The size used for the Active Directory thumbnailPhoto attribute is only 48 pixels by 48 pixels. If you would like to get higher resolution pictures rather than AD thumbnailPhoto attribute that is synced from UPS to SharePoint on-premises, you have the following options.


In this blog, we will explain the details to import high resolution pictures from exchange to SharePoint on-premises since we have pictures already imported in exchange. 

     1.  Establish an OAuth trust and service permissions in Exchange
a.       On the Exchange server, login as Administrator and open the Exchange Management Shell through the start menu
b.       Navigate to the scripts directory "C:\Program Files\Microsoft\Exchange Server\V15\Scripts"
c.       Enter the following command, where the AuthMetadataUrl begins with the hostname of the My Site Host
.\Configure-EnterprisePartnerApplication.ps1 -ApplicationType SharePoint -AuthMetadataUrl https://sp.contoso.com/_layouts/15/metadata/json/1



d.       A successful completion of the command should look like this:
        
2.  Set up the OAuth Trust within SharePoint.
a.       Complete the following steps on the SharePoint server that hosts the My Site web application
b.       Create the new SPTrustedSecurityTokenIssuer
$realm = Get-SPAuthenticationRealm
$nameid = "00000002-0000-0ff1-ce00-000000000000@$realm"
New-SPTrustedSecurityTokenIssuer -Name "Exchange" -MetadataEndPoint "https://exch.contoso.com/autodiscover/metadata/json/1" -RegisteredIssuerName $nameId

3.   Configure the Security Token Service
$sts = Get-SPSecurityTokenServiceConfig
$sts.AllowMetadataOverHttp = $true
$sts.Update()


 Note: If the My Site is not an SSL site, update the above to include the following line before the update:
$sts.AllowOAuthOverHttp = $true

Configure Exchange external URLs

Exchange needs to be configured to communicate using various external URLs. Complete the following steps on the Exchange server
4.     Exchange Web Services (picture retrieval) - Configure the Exchange Web Services (EWS) external URL
a.       Confirm that the External URL is not currently configured
Get-WebServicesVirtualDirectory | fl *url*


b.       Set the External URL to the same value as shown for the Internal URL returned from the previous command
Get-WebServicesVirtualDirectory | Set-WebServicesVirtualDirectory -ExternalUrl "https://exch.contoso.com/EWS/Exchange.asmx"
5.      Exchange Control Panel (picture retrieval) - Configure the Exchange Control Panel (ECP) external URL
a.       Confirm that the External URL is not currently configured
Get-EcpVirtualDirectory | fl *url*


b.       Set the External URL to the same value as shown for the Internal URL returned from the previous command
Get-EcpVirtualDirectory | Set-EcpVirtualDirectory -ExternalUrl "https://exch.contoso.com/ECP/"
6.      Outlook Web Access. Because we changed the ECP external URL, we need to do the same for the OWA External URL
a.       Confirm that the External URL is not currently configured
Get-OwaVirtualDirectory | fl *url*

b.       Set the External URL to the same value as shown for the Internal URL returned from the previous command
Get-OwaVirtualDirectory | Set-OwaVirtualDirectory -ExternalUrl "https://exch.contoso.com/owa"

 


If some reason, the photo is not showing you might be able to diagnose the issue by examining the ULS logs available at C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\LOGS. You might need to run picture split powershell to generate three different size of the pictures used by SharePoint.

When you decide to move this to production,  please be aware of some design issues and limitations I will explain in the future blog.

No comments:

Post a Comment