We are creating a team group (with the beta Graph API) and we want the emailaddress to contain another value than the value that's based on what's provided in displayName.
While searching through the documentation it seems that this is possible by providing a value for mailNickname in AdditionalData (https://learn.microsoft.com/en-us/graph/teams-create-group-and-team).
So I implemented that. Unfortunately the mailaddress and the alias were still like [email protected] instead of [email protected].
var graphApiServiceClient = new GraphServiceClient(this.authenticationProvider)
{
BaseUrl = "https://graph.microsoft.com/beta"
};
var owner = "valueForOwner";
var teamTemplate = teamTemplateType == TeamTemplateType.Staff
? "educationStaff"
: "educationClass";
var team = new Team
{
AdditionalData = new Dictionary<string, object>
{
{ "[email protected]", $"https://graph.microsoft.com/beta/teamsTemplates('{teamTemplate}')" },
{ "[email protected]", new[]{$"https://graph.microsoft.com/beta/users('{owner}')"}},
{ "displayName", "TestGroup" },
{ "description", "This is a testgroup" },
{ "mailNickname", "TestMailNickname" }
}
};
await graphApiServiceClient.Teams.Request().AddAsync(team);
The MailNickname does change when I update the MailNickname property afterwards with an update request like await graphApiServiceClient.Groups[objectId].Request().UpdateAsync(new Group { MailNickname = mailNickname});.
This is confirmed with a graphApiServiceClient.Groups[objectId].Request().GetAsync()
Unfortunately it still shows [email protected] as the alias in the admin at https://admin.microsoft.com/AdminPortal/Home#/groups.
But, updating the value like this doesn't work for the Mail property because it states it's readonly in the update request.
Does anyone know what I am doing wrong in my original create/add request?
Plus does anyone know why the old alias value is still shown instead of the updated alias at https://admin.microsoft.com/AdminPortal/Home#/groups?
This is possible by creating a group via the Graph api first and then using the group ID to create a team for this group.
Create the group via "https://graph.microsoft.com/v1.0/groups".
Once the group has been made it'll output an ID which you'll then use to create a team via "https://graph.microsoft.com/v1.0/groups/YOURIDHERE/team"
Body would look something like;