SPFx - SharePoint Online User Profile Photo Sync

SUDHARSAN KESAVANARAYANANSharePoint Architect
CERTIFIED EXPERT
Microsoft MVP Office Dev focussed on Azure services, M365, SharePoint On-Premise & SharePoint Online, Power Automate, Power Apps, LiveTiles
Published:
This article examine how we can use SPFx web part that would facilitate the administrator to sync the profile photos from Azure AD or the FileShares to SharePoint User Profile store.

Target Audience

  • Administrators currently maintaining user profiles
  • To give a copy to your Administrator if your profile photos aren't synched  
  • Powershell and Scripts will need to be run
  • This solution doesn't work on local mode

Introduction

Hi, friends a few days ago I had posted an article on 'SharePoint Online User Photo Sync.' It explains how the user photos displayed in the SharePoint site from the exchange online and also covered the option for syncing the photos from AAD to SharePoint using PnP Profile Uploader.

In this post, let me introduce you to the SPFx web part that would facilitate the administrator to sync the profile photos from Azure AD or the FileShares to the SharePoint User Profile Store.

Features

  • User selection will help you to update only specific user based on the selection. It will also allow the users to fetch the photos from Azure AD before starting the synchronization.
  • Bulk Sync will allow the admin to upload the photos from their file shares. The filename should be in the format 'UserID.jpg'.
  • Access control based on SharePoint Group, not all the users can access the application.
  • Separate section to check the status of the photo update.
  • Azure Function to handle the photo update. PnPPowershell is used in Azure Function.
  • The application supports SPA.
Note: All the supporting lists were created when the web part is loaded for the first time. Whenever the web part is loaded, the supported lists were checked whether it exists or not.

Properties

  • Select a library to store the thumbnails: A document library to store the thumbnail photos.
  • Delete thumbnail stored: This flag will decide whether you want to keep the thumbnails generated or to clean them after the sync completed.
  • Azure Function URL: Azure function URL to run the photo update.
  • Use Certificate for Azure Function authentication: The video mentioned below to set up Azure Function has different options. This setting will decide whether to use the certificate or stored credentials to communicate with SharePoint.
  • Date format: Date format to be used across the entire application. Used momentJS.
  • SharePoint Groups: Only the users from the configured SharePoint Groups and Site Administrator shall be allowed access.
  • Use page full width: This is used when the web part is added to a site page where it has to use the full width.

Preview



Source Code

The above web-part is shared with the community and is free to use. Please click the below link to see more information, download the code, installation instructions and have fun. 

React-Photo-Sync

Note :  Azure Function has to be setup for property update. The actual powershell is uploaded in the assets folder. Follow the steps explained in the video by Paolo Pialorsi. 

Previews

User Selection sync : SPUPS_Photo_Sync_1.gif
Bulk Sync : SPUPS_Photo_Sync_2.gif

Happy Coding…
0
676 Views
SUDHARSAN KESAVANARAYANANSharePoint Architect
CERTIFIED EXPERT
Microsoft MVP Office Dev focussed on Azure services, M365, SharePoint On-Premise & SharePoint Online, Power Automate, Power Apps, LiveTiles

Comments (0)

Have a question about something in this article? You can receive help directly from the article author. Sign up for a free trial to get started.