Tuesday, February 20, 2018

Automatically set an Office 365 Group Logo - Another free SharePoint Framework extension from Puzzlepart

image

Photo by Mikael Svenson

If you haven’t caught on already, at Puzzlepart we love sharing our small quirky workarounds. This time around it’s a run-once extension which will set the logo for an Office 365 Group when a group owner visits the site for the first time.

Get the extension code!

The problem with Office 365 Group logo’s from a provisioning perspective is that you have to set the logo in user context. This means the upload must be performed by a group owner (or another admin), and cannot be achieved using app-only tokens.

The way this SPFx application customizer works is:

  1. Once you visit the modern team site of an Office 365 Group the first time the logo will be auto generated showing letters as usual.
    image
  2. The extension will kick in and show a dialog, fetch the logo image from a known URL, and upload it via the Microsoft Graph.
    image
  3. Close the dialog, and after a little while the logo will sync it’s way back from the Microsoft Graph to the SharePoint site. This means it will not show right away, but after a refresh or five it will be there :-)
    image