microsoftgraph / msgraph-sdk-serviceissues

Tracks service issues for follow up.
5 stars 0 forks source link

Creating a Team based on a M365 group no longer works. #106

Open Prov-Matthias opened 3 years ago

Prov-Matthias commented 3 years ago

We use the Graph REST API (v1.0) regularly for this and have the problem again and again temporarily for sometimes 2 to 3 hours.

But in our Production (Azure Function) for 14 days permanently now.

In my Visual Studio 2019 environment, it occasionally works to create a Team when the function is run locally.

Expected behavior

Creating a Team from a new M365 Group (Example 4 - Documentation).

Actual behavior

The M365 Group will be created and the Team request runs in an error.

[2021-06-16T08:36:53.200Z] [Error] Message: Code: NotFound
[2021-06-16T08:36:53.201Z] Message: Failed to execute Templates backend request CreateTeamFromGroupWithTemplateRequest. Request Url: https://teams.microsoft.com/fabric/emea/templates/api/groups/34cc48c4-xxxxxxxx52b08f/team, Request Method: PUT, Response Status Code: NotFound, Response Headers: Strict-Transport-Security: max-age=2592000
[2021-06-16T08:36:53.202Z] x-operationid: 7bc3cede133eef4eba8ded823e395776
[2021-06-16T08:36:53.205Z] x-telemetryid: 00-7bc3cede133eef4eba8ded823e395776-972dd03038e92b42-00
[2021-06-16T08:36:53.207Z] X-MSEdge-Ref: Ref A: 66F26DD1C45B4F15BC4873D881BAD1C3 Ref B: VIEEDGE1115 Ref C: 2021-06-16T08:36:52Z
[2021-06-16T08:36:53.208Z] Date: Wed, 16 Jun 2021 08:36:52 GMT
[2021-06-16T08:36:53.209Z] , ErrorMessage : {"errors":[{"message":"Failed to execute GetGroupAsync.","errorCode":"Unknown"}],"operationId":"7bc3cede133eef4eba8ded823e395776"}
[2021-06-16T08:36:53.210Z] Inner error:
[2021-06-16T08:36:53.210Z]      AdditionalData:
[2021-06-16T08:36:53.212Z]      date: 2021-06-16T08:36:53
[2021-06-16T08:36:53.213Z]      request-id: b6fad643-f210-4ca1-a9a9-20a8c16b7023
[2021-06-16T08:36:53.216Z]      client-request-id: b6fad643-f210-4ca1-a9a9-20a8c16b7023
[2021-06-16T08:36:53.217Z] ClientRequestId: b6fad643-f210-4ca1-a9a9-20a8c16b7023
[2021-06-16T08:36:53.219Z]
[2021-06-16T08:36:53.222Z] ---------------------------------
[2021-06-16T08:36:53.225Z] [Error] Source: Microsoft.Graph.Core
[2021-06-16T08:36:53.228Z] ---------------------------------
[2021-06-16T08:36:53.284Z] [Error] StackTrace:    at Microsoft.Graph.HttpProvider.SendAsync(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationToken cancellationToken)
[2021-06-16T08:36:53.286Z]    at Microsoft.Graph.BaseRequest.SendRequestAsync(Object serializableObject, CancellationToken cancellationToken, HttpCompletionOption completionOption)
[2021-06-16T08:36:53.287Z]    at Microsoft.Graph.BaseRequest.SendAsync[T](Object serializableObject, CancellationToken cancellationToken, HttpCompletionOption completionOption)
[2021-06-16T08:36:53.290Z]    at Provectus_NewCloudAccess.Team.PostTeam(HttpRequest req, ILogger log) in C:\GitRepositories\Provectus-NewCloudAccess\Team.cs:line 212
[2021-06-16T08:36:53.291Z] ---------------------------------
[2021-06-16T08:36:53.292Z] [Error] Code
[2021-06-16T08:36:53.295Z] ---------------------------------
[2021-06-16T08:36:53.311Z] Executed 'postTeam' (Succeeded, Id=c4009ca5-c173-4ebf-b132-f611463f54bf, Duration=27343ms)

Steps to reproduce the behavior

  1. Create a new M365 Group request
XXX.Commands.CreateGroup createGroup = new Commands.CreateGroup();
var createGroupResult = await createGroup.Run(paraDisplayName, GroupOwners);
newGroupId = createGroupResult.Id.ToString();
    public class CreateGroup
    {
        private static readonly GraphServiceClient graphClient = AuthHandler.GetAuthenticatedGraphClient();

        public async Task<Microsoft.Graph.Group> Run(string displayName, StringCollection groupOwners)
        {
            StringCollection BehaviorOptions = new StringCollection();
            String[] arrOptions = new String[] { "HideGroupInOutlook", "WelcomeEmailDisabled" };
            BehaviorOptions.AddRange(arrOptions);

            string mailNickname = Helpers.Checkups.CheckMailNicknameCharacters(displayName);

            Microsoft.Graph.Group definitionNewGroup = new Microsoft.Graph.Group
            {
                Description = displayName + "Team",
                DisplayName = displayName,
                GroupTypes = new List<string>()
                    {
                    "Unified"
                    },
                MailEnabled = false,
                MailNickname = mailNickname,
                SecurityEnabled = false,
                Visibility = "Private",
                AdditionalData = new Dictionary<string, object>()
                        {
                            {"owners@odata.bind", groupOwners},
                            {"resourceBehaviorOptions", BehaviorOptions}
                        }
            };

            Microsoft.Graph.Group createGroupResult = await graphClient.Groups
                .Request()
                .AddAsync(definitionNewGroup);

            return createGroupResult;

        }
    }
  1. Start Stopwatch for 20 Secends to create a delay between the calls.
var stopwatch = new Stopwatch();
  stopwatch.Start();

=> When I set a break point, I can see that the groupID is available.

  1. Create new Team request
string graphURICreateTeam = string.Format("https://graph.microsoft.com/v1.0/groups('{0}')", newGroupId);

var definitionNewTeam = new Microsoft.Graph.Team
{
    MemberSettings = new TeamMemberSettings
    {
        AllowCreatePrivateChannels = true,
        AllowCreateUpdateChannels = true
    },
    MessagingSettings = new TeamMessagingSettings
    {
        AllowUserEditMessages = true,
        AllowUserDeleteMessages = true
    },
    FunSettings = new TeamFunSettings
    {
        AllowGiphy = true,
        GiphyContentRating = GiphyRatingType.Strict
    },
    AdditionalData = new Dictionary<string, object>()
     {
        {"template@odata.bind", "https://graph.microsoft.com/v1.0/teamsTemplates('standard')"},
         {"group@odata.bind", graphURICreateTeam}
    }
};

var createTeamResult = await graphClient.Teams
    .Request()
    .AddAsync(definitionNewTeam);

After searching on StackOverflow and Git, I tryed a few workarrounds but nothing works.

For example with the Beta API:

- string graphURICreateTeam = string.Format("https://graph.microsoft.com/beta/groups('{0}')", newGroupId);
- {"template@odata.bind", "https://graph.microsoft.com/beta/teamsTemplates('standard')"}

AB#9931

petrhollayms commented 2 months ago

Thank you for reporting this issue. This appears to be an issue or limitation with the service APIs. Unfortunately, as the Microsoft Graph SDK team, we do not have ownership of the APIs that are causing you issues. We invite you to create a question about the service API to Microsoft Q&A and tagged with one of the [microsoft-graph-*] tags, that way it will get routed to the appropriate team for them to triage:

https://aka.ms/msgraphsupport or directly https://aka.ms/askgraph

For now, we will close the issue on our side but feel free to open it in the relevant repository if you think the issue is specific to SDK. Please let us know if this helps!

Note: We will close this repository on April 19, 2024.