While working on an automation solution for Microsoft Teams with SharePoint modern sites, we faced an issue while updating the logo after creation. This was a weird issue as we were able to set the logo while creating but it stopped working after site was created. The cause and the fix of the issue was really something I didn’t assume would be the cause and took me about a day to find it and then resolve. So, hoping this blog will save some time for others who face the same issue.
Below is a snapshot of the error. The issue is actually at least shown when trying to update the logo from the “Site Information” panel on SharePoint site but is not shown or provided when doing it from PnP PowerShell or “Change the look” -> “Header” section. However, while looking at the issue it didn’t give me an exact cause of the issue and sent me across a rabbit hole to find the cause. And to my astonishment, the cause and fix was something completely different. Please read the details below.
The cause of the issue was completely unrelated to the issue description but might make sense in a way. The cause was that we have hidden the Office 365 group from address list after creation. The reason of doing this was because the groups were created first and then upgraded to Microsoft Teams.
Below is the command we ran to hide the office 365 groups. The command runs in Exchange online command shell. Here is a quick link to the documentation. The code for quick view is below
Set-UnifiedGroup -Identity <groupAlias> -HiddenFromAddressListsEnabled:$True
I suppose the above was causing the issue for the GroupService Api call to not find the group in order to update the logo, which is again weird as the Unified Group commands could find the group.
The resolution to the issue was quite simple after we realized this was the cause. We just had to undo hide from address list and then update the logo and re-hide from the address list and there you go!! It works.
The code to unhide from the address list is the same as above but with the $false parameter.
Set-UnifiedGroup -Identity <groupAlias> -HiddenFromAddressListsEnabled:$False
So, we reset the flag on the hidden list and then update the logo using PnP PowerShell. That’s the fix.