0
votes

I created a group via MSGraph API. It worked fine. Group was created with owners, members and so on. Now I created a Team in MSTeams out of the group manually. But I can't send files because there is no sharepoint site!

I tried to get the sharepoint link via GraphExplorer but it responses 404.

So I tested the API via GraphExplorer and created a group with it. It works. There is the group, and the sharepoint site...

This is the code for creating a new Group. (IT's the same Code like in the MSDocs)

IGraphServiceClient graphApplicationClient = _initGraphServiceApplicationClient();

Group group = new Group();
group.displayName = pGroupDisplayName;
group.description = pGroupDescription;
group.mailEnabled = pMailEnabled;
group.mailNickname = pGroupMailNickname;
group.securityEnabled = pSecurityEnabled;

//Office Group
LinkedList<String> groupTypesList = new LinkedList<>();
groupTypesList.add("Unified");
group.groupTypes = groupTypesList;

group.additionalDataManager().put("[email protected]", _buildMemberJsonArray(pAzureOwnerIds));
pAzureMemberIds.addAll(pAzureOwnerIds);
group.additionalDataManager().put("[email protected]", _buildMemberJsonArray(pAzureMemberIds));

Group groupResponse = graphApplicationClient.groups().buildRequest().post(group);

return groupResponse.id;

If I run this in my Java application, the request is working fine. But there is no Sharepoint site created with it. If I go to AzurePortal -> Groups there is no Group link to sharepoint. If I do the same request with the same Url, members, owners, properties in Postman or GraphExplorer, it creates a sharepoint in under 1 minute.

Why doesn't it work with code???

This is the group in azure if I create it with code and create a team out of it manually

Group out of code

Still waiting for a sharepoint

Not able to send files

This is the group in azure if I create it with azure and create a team out of it manually

[Group out of azure[2]

Sharepoint in under 1minute created..

Able to send files

Best regards!

1
Could you please update your question with piece of code that you are trying so we can take a look? - Trinetra-MSFT
I did. I'm not sure if u get a notification if i do it (I'm new). So I mention u here @Trinetra-MSFT. Please, have a look. - Martin Bilda
Thanks, Let me have a look, i will get back to you on this soon - Trinetra-MSFT

1 Answers

0
votes

I tested this issue with following code and it works well.

using Microsoft.Graph;
using Microsoft.Graph.Auth;
using Microsoft.Identity.Client;
using System;
using System.Collections.Generic;

namespace CreategroupTeam
{
    class Updateitem
    {
        static void Main(string[] args)
        {
            string clientId = "e0cxxxx63112"; //e.g. 01e54f9a-81bc-4dee-b15d-e661ae13f382
            string clientSecret = @"1kQTuxxxxx?um05-qZ";
            string tenantID = "8a400dxxxxx872cfeef";

            IConfidentialClientApplication confidentialClientApplication = ConfidentialClientApplicationBuilder
                    .Create(clientId)
                    .WithTenantId(tenantID)
                    .WithClientSecret(clientSecret)
                    .Build();

            ClientCredentialProvider authProvider = new ClientCredentialProvider(confidentialClientApplication);
            GraphServiceClient graphClient = new GraphServiceClient(authProvider);

            var group = new Group
            {
                Description = "Group with designated owner and members",
                DisplayName = "Operations group",
                GroupTypes = new List<String>()
                {
                    "Unified"
                },
                MailEnabled = true,
                MailNickname = "operations2019",
                SecurityEnabled = false,
                AdditionalData = new Dictionary<string, object>()
                {
                    {
                        "[email protected]",new []{ "https://graph.microsoft.com/v1.0/users/942dd484-cbed-4ed8-b9a8-3f70ef070a4a", "https://graph.microsoft.com/v1.0/users/cb281e9e-7c81-4834-b39d-3ae34f5255e8" }
                    },
                    {
                        "[email protected]",new []{ "https://graph.microsoft.com/v1.0/users/73d72173-732b-4b19-a9c8-b9b0c5e0a567" }
                    }
                }
            };

            var res = graphClient.Groups.Request().AddAsync(group).Result;
            Console.WriteLine(res);

            Console.ReadKey();
        }
    }
}

After the group created, i manually created a team under this group. All works well, i am able to open the associated SharePoint site (it may take some times to finish initialization, so in fact i wait for a while). enter image description here