Forum Discussion

SkypeForBusiness's avatar
SkypeForBusiness
Copper Contributor
Oct 30, 2023
Solved

MS-Teams Command "New-Team" Site URL incorrect

Hi all,

 

I want to automatically create a MS Teams Team with a SharePoint Site. I use the following command:

$teamName = Read-Host -Prompt 'Input your team name'
New-Team -DisplayName $teamName -Owner email address removed for privacy reasons -Visibility "Private" 

The Team is getting created but the Site URL looks strange - I would like to have the same Name in the URL as the Display name but it is like sites/msteams_123456

What am I doing wrong?

 

Many thanks

  • LainRobertson's avatar
    LainRobertson
    Oct 30, 2023

    SkypeForBusiness 

     

    According to the documentation for the Alias (aka mailNickname), there's no problem with using a hyphen. And that's backed up by your manual testing.

     

    It will be some other character that's causing the error, not the hyphen.

     

    What value are you trying to specify for -MailNickname?

     

    Cheers,

    Lain

4 Replies

  • LainRobertson's avatar
    LainRobertson
    Silver Contributor

    SkypeForBusiness 

     

    I don't work with SharePoint, but according to the documentation, the modern team site URI is based on the mailNickname value, which you are not including in your example.

     

     

    So, perhaps try adding the "-MailNickname mysitename" parameter into your existing New-Team commandlet and see if that results in a more meaningful URI.

     

    Note: We cannot see what value is stored in your $teamName variable, but be aware that certain characters cannot be used in mailNickname (notably spaces, which are most common in display names):

     

     

    You will want to ensure that you remove all ineligible characters from your $teamName variable. (i.e. store a parsed value in another variable, or remove them on the fly - there's multiple ways for achieving this required outcome.)

     

    Cheers,

    Lain

    • SkypeForBusiness's avatar
      SkypeForBusiness
      Copper Contributor
      Hi Lain,

      It is working with the mailNickname value but I need to have the "-" in it. When I create the Group manually it is possible to have the "-" in the URL. Is there a solution for this? now it says:
      New-Team : Error occurred while executing
      Code: Request_BadRequest
      Message: Invalid value specified for property 'mailNickname' of resource 'Group'.
      • LainRobertson's avatar
        LainRobertson
        Silver Contributor

        SkypeForBusiness 

         

        According to the documentation for the Alias (aka mailNickname), there's no problem with using a hyphen. And that's backed up by your manual testing.

         

        It will be some other character that's causing the error, not the hyphen.

         

        What value are you trying to specify for -MailNickname?

         

        Cheers,

        Lain

Resources