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.
Happy Coding…
Pingback: SharePoint PnP Dev SPFx JS SIG Call – October 22nd, 2020 – Screenshot Summary - Warner Digital
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
LikeLiked by 1 person
Hi, I always use jQuery to do the DOM manipulation since it provides a very flexible way and easy to implement. You can also refer one of my solutions, I had used the same technique to use the full width.
https://github.com/pnp/sp-dev-fx-webparts/tree/master/samples/react-spupsproperty-sync
LikeLiked by 1 person
Your style is very unique compared to other people I’ve read stuff from. Thank you for posting when you have the opportunity, Guess I’ll just book mark this web site.
LikeLiked by 1 person