Search code examples
sharepointmicrosoft-graph-apimicrosoft-teamsmicrosoft-graph-teams

Microsoft Teams channel email address, SharePoint and files are inaccessible when the team is created using Graph Api


I am creating Teams from Groups by calling the Graph Api as described in the docs. When I view a channel on newly created Team in Teams, some SharePoint related actions aren't accessible:

  1. Select 'Get email address' from the channel (via the 3 dots menu), I receive the following message. "We're still setting up your team. Please try again later." By querying the Graph Api channels endpoint I can see that the email property is empty.
  2. Select 'Open in SharePoint' from the channel (via the 3 dots menu in the top right), I receive the following message "We are setting up your file directory. Try refreshing the page after a few minutes or check back later."
  3. Go to the 'Files' tab, I receive the following message "We can't get your files. We're working on getting them back."

At this point the corresponding SharePoint site does exist, as I can access it directly.

When you create a Team through Teams, none of the above issues occur.

A Teams user can get round this by visiting either the 'Files' or 'Wiki' tabs. Once you've clicked on one of these tabs, then the above issues don't occur anymore. My guess is that by visiting one of the tabs Teams makes a call that sets up or synchronises SharePoint with the channel in Teams. Is there a Graph/SharePoint or otherwise Api endpoint I can call that will do the same?

Below is a few other things I've tried/found:

  • The issues are still a problem after a significant amount of time. (I always see this issue when a Team is created through Graph from 20 seconds to 3 months after creation.)
  • I have tried using the newer beta endpoint to create the Team, I get the same result.
  • By querying Graph I have compared the properties of a Group, Team and Channels when the Team is created through Teams with the properties of those when the Team is created through through Graph. The properties are identical, apart from the expected identifiable information (ids, names etc).
  • The issue occurs when viewing the channel in both the Teams web and desktop clients.

Solution

  • I raised a support ticket with Microsoft and had a call regarding the issue, and their explanation was as follows.

    The issue is due to the General folder not being created in Sharepoint yet. This can take up to 48 hours (although I have experienced it taking longer). If you don't want to wait 48 hours you can make a call to Graph (see below) that will force the General channel folder to be created immediately.

    POST https://graph.microsoft.com/v1.0/groups/063589dc-7260-4a34-996e-317f7b036c38/drive/root/children

    {
      "name": "General",
      "folder": {},
      "@microsoft.graph.conflictBehavior": "replace"
    }
    

    I haven't used this solution in production yet, but this works for me when making calls through Graph Explorer, which it didn't before.