Inconvenient setting logo on a newly created Office 365 Group
Using the Microsoft Graph you can easily create a new Office 365 Group, that is, until you try to set its logo.
A place to collaborate
Office 365 Groups offer organizations a convenient way to facilitate collaboration. They combine a number of Office 365 resources such as messages, calendar, documents or planner, offering their members a single place to go to, to work with each other.
Office 365 users can easily create Office 365 Groups through the user interface. But you could also think of automating creating Office 365 Groups as a part of your business process or when migrating an existing on-premises intranet to Office 365.
Programmatically creating Office 365 Groups
The API required to programmatically create Office 365 Groups is exposed through the Microsoft Graph. In your solution, you can choose to interact directly with the Microsoft Graph API or use any of its wrappers instead such as the Office 365 CLI, PnP PowerShell or the PnP Core Component.
The API for working with Office 365 Groups exposed through the Microsoft Graph is verbose and focused on a single operation. If you wanted to create a new Office 365 Group, set its owners, members and logo, using the Microsoft Graph you would have to issue a number of separate requests to the API. And the real trouble start, when you try to create a new Office 365 Group and set its logo right after.
Inconvenient setting logo of a newly created Office 365 Group
If you create a new Office 365 Group using the Microsoft Graph and try to set its logo right after, you will likely get an error similar to the following:
404: The requested group 'c744c03e-cddb-40ce-b015-c42c26e745a0@67753f63-bc14-4012-869e-f808a43fe023' is invalid.
or another like:
403: Access denied
or even one like:
500: Active Directory operation did not succeed. Try again later., Active Directory operation failed on VI1P190A001DC02.EURP190A001.PROD.OUTLOOK.COM. The object 'CN=my_group_2d12577556,OU=contoso.onmicrosoft.com,OU=Microsoft Exchange Hosted Organizations,DC=EURP190A001,DC=PROD,DC=OUTLOOK,DC=COM' does not exist.
But if you try long enough, you will eventually succeed setting the group logo.
200: OK
Sure, Office 365 Groups are complex and comprise of a number of different services combined together, which is why sometimes it takes a moment for the group and all its resources to be provisioned. Still, the way the Microsoft Graph API handles requests is confusing and makes it hard to distinguish between the actual errors and issues caused by the group not being fully provisioned yet.
If you use any of the wrappers such as the Office 365 CLI, PnP PowerShell or the PnP Core Component, they handle this intricacy already for you. If you choose to interact with the Microsoft Graph yourself, you will have to handle it yourself to deliver a working solution.
Photo by Masha Danilova