Forum Discussion

SiddheshwarKohale's avatar
SiddheshwarKohale
Brass Contributor
Dec 21, 2020

Group naming policy enabled tenant - Not allowing to create 'Teams' through provisioned jobs

Hello All,

Actually We have enabled 'Group Naming policy' on our O365 tenant like below:
Current Policy:
<Group name>(<Company>)

It works perfectly fine when we create Teams through Teams App but we are facing below error
when we try to create through CSOM based (c#) provisioning console job. To fit in naming policy we
are fetching user's company name and appending suffix to Group name. Ex. TestTeam(CompanyName)
Error Message:
Code: Request_BadRequest Message: The property is missing a required prefix/suffix per your organization's Group naming requirements. Details: Detail0: Code: MissingPrefixSuffix Target: displayName AdditionalData: suggestedPropertyValue : sid-12-18-2021(MyCompany)()
Below source code we are referring to create Teams:
UnifiedGroupEntity unifiedGroupEntity = UnifiedGroupsUtility.CreateUnifiedGroup(
unifiedGroupInformation.DisplayName, unifiedGroupInformation.Description,
unifiedGroupInformation.MailNickname, accessToken, unifiedGroupInformation.Owners,null,
true, true, 10, 500);

Please let me know where the things getting wrong.
BR/ Sid
  • SiddheshwarKohale , There are some strict guidelines that are to be followed when creating a group policy in azure active directory that enforces consistent naming conventions for  Microsoft 365 groups created or edited by your users, set up a group naming policy for your organizations in Azure Active Directory (Azure AD). 

     

    I would suggest you to refer to your naming policies in your AAD and use the same to create a group using console job. As from your error it's clear that there is some format error in prefix and suffix. 

     

    Please follow this article for more details.

     

    Also check if the data is already filled in object in code before creating a team

    • SiddheshwarKohale's avatar
      SiddheshwarKohale
      Brass Contributor

      Manish-MSFT  - We are already using C# based console job to create Teams.  Below are few more details:

      Azure AD Group Policy:

      Error Message:

      Stack Trace:

      UnifiedGroupInformation Payload is like this before creating Teams:

      Code snippet:

       

      Still we are facing similar issue. Please suggest possible solutions if any.

       

      Thanks.

      BR. Sid

Resources