SPFx – SharePoint Online User Profile Photo Sync

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 on 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 AAD or the FileShares to 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 it 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 setup 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 full width.

Preview

Source Code

The above web-part is shared with the community and is of free to use. Please click the below link to download the code and have fun.

React-Photo-Sync

Happy Coding…

3 thoughts on “SPFx – SharePoint Online User Profile Photo Sync

  1. Pingback: SharePoint PnP Dev SPFx JS SIG Call – October 22nd, 2020 – Screenshot Summary - Warner Digital

  2. I wanted to use your trick to get the full width, so I tested:
    jQuery(“.SPCanvas-canvas”).prop(“style”, “max-width: none”);
    jQuery(“.CanvasZone”).prop(“style”, “max-width: none”);
    But without jQuery
    document.getElementsByClassName(‘SPCanvas-canvas’)
    document.getElementsByClassName(‘CanvasZone’)
    But sometimes it works because there is 1 item in the array but other times the HTMLCollection is empty.
    Does it always work for you? Any web part?
    Thank you

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s