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

2 comments:

  1. Hi Mikael! Thank for posting this!
    Following https://github.com/Puzzlepart/spfx-solutions/tree/master/Pzl.Ext.GroupLogo
    I connected via Connect-PnPOnline -Url "https://mysp.sharepoint.com/sites/targetsite" and tried to do it via Apply-PnPProvisioningTemplate -Path mytemplate.xml -Parameters @{"LogoUrl"="https://mysp.sharepoint.com/sites/targetsite/SiteAssets/logo.jpg"}, but the group logo was not updated. It's a modern site created via new group in owa, site is also allowed to run script and my PowerShell ISE shows no debug error. I have not deployd the sppkg.
    Am I missing something?
    Thank you again!

    ReplyDelete
    Replies
    1. Once installed, when a Group owner visits the site, the logo will be set - and will be sync'd back to SharePoint in a little while. The logo is not set by just applying the application customizer.

      Delete