1

Bot framework .Activity.TeamsGetTeamInfo().Id Docs gives Ids in the format of 19:pmwblabla-DU6Cjf25Fblablabla@thread.tacv2, but Graph API takes Ids in the form of GUIDs 1be44bc0-02cb-4715-9ecc-cba191e64cb5 Docs.

Graph API will return the "InternalId" which matches the Bot Framework, but how do I get the GUID from the Bot framework request?

I just want to do simple stuff like invite people to a team, create/delete teams/channels.

The Request to the server does not include the info, so DialogContext.Activity.TeamsGetTeamInfo().AadGroupId is useless:

{
    "text": "<at>TestBot</at> help\n",
    "textFormat": "plain",
    "attachments": [
        {
            "contentType": "text/html",
            "content": "<div><div><span itemscope=\"\" itemtype=\"http://schema.skype.com/Mention\" itemid=\"0\">TestBot</span> help</div>\n</div>"
        }
    ],
    "type": "message",
    "timestamp": "2022-05-26T06:33:49.1002055Z",
    "localTimestamp": "2022-05-26T13:33:49.1002055+07:00",
    "id": "165354145676828864",
    "channelId": "msteams",
    "serviceUrl": "https://smba.trafficmanager.net/emea/",
    "from": {
        "id": "29:1d9mrAWL8cZKs3gp4Pasd8WD771EhsE1tlCs_MQn1Rb5QTmzk71GK934z8sxyHBE0eRFhWf-YslJXt_HdNDag",
        "name": "MyName",
        "aadObjectId": "guid-guid-guid-guid-guid"
    },
    "conversation": {
        "isGroup": true,
        "conversationType": "channel",
        "tenantId": "guid-guid-guid-guid-guid",
        "id": "19:eZWOxzVhYnXQasd07VtQVpdAHkgfP-7JyvcJR-0_w1@thread.tacv2;messageid=1653026739856"
    },
    "recipient": {
        "id": "28:guid-guid-guid-guid-guid",
        "name": "TestMyBot2343456345656367"
    },
    "entities": [
        {
            "mentioned": {
                "id": "28:guid-guid-guid-guid-guid",
                "name": "TestBot"
            },
            "text": "<at>TestBot</at>",
            "type": "mention"
        },
        {
            "locale": "en-US",
            "country": "US",
            "platform": "Windows",
            "timezone": "here",
            "type": "clientInfo"
        }
    ],
    "channelData": {
        "teamsChannelId": "19:eZWOxzasdasdasdHkgfP-7JyvcJR-0_w1@thread.tacv2",
        "teamsTeamId": "19:eZWOxzasdasdasdHkgfP-7JyvcJR-0_w1@thread.tacv2",
        "channel": {
            "id": "19:eZWOxzasdasdasdHkgfP-7JyvcJR-0_w1@thread.tacv2"
        },
        "team": {
            "id": "19:eZWOxzasdasdasdHkgfP-7JyvcJR-0_w1@thread.tacv2"
        },
        "tenant": {
            "id": "guid-guid-guid-guid-guid"
        }
    },
    "locale": "en-US",
    "localTimezone": "here"
}
Cine
  • 4,255
  • 26
  • 46
  • Could you please elaborate your requirement and share the repro steps, so that we can try it from our end. – Sayali-MSFT May 18 '22 at 10:25
  • @Sayali-MSFT I thought I made it quite clear. DialogContext.Activity.TeamsGetTeamInfo().Id gives an id like 19:pmwblabla-DU6Cjf25Fblablabla@thread.tacv2. Graph API requires GUIDs https://graph.microsoft.com/v1.0/teams/GUID, any attempt to use the 19:.. gives an error that it requires a valid GUID. – Cine May 18 '22 at 10:34
  • 1
    Can you please use DialogContext.Activity.TeamsGetTeamInfo().AadGroupId Ref Doc- https://learn.microsoft.com/en-us/dotnet/api/microsoft.bot.schema.teams.teaminfo.aadgroupid?view=botbuilder-dotnet-stable – Sayali-MSFT May 18 '22 at 12:29
  • { "id": "19:pmwblabla-DU6Cjf25Fblablabla@thread.tacv2", "name": null, "aadGroupId": null } – Cine May 19 '22 at 03:22
  • @Sayali-MSFT I included the full request from teams to my server above. – Cine May 26 '22 at 06:41
  • @Cine-Are you looking for this-https://learn.microsoft.com/en-us/graph/api/chatmessage-get?view=graph-rest-1.0&tabs=http#example-2-get-a-message-in-a-channel In the channelIdentity section you will get the teams id as mention above- "channelIdentity": { "teamId": "fbe2bf47-16c8-47cf-b4a5-4b9b187c508b", "channelId": "19:4a95f7d8db4c4e7fae857bcebe0623e6@thread.tacv2" }, – Sayali-MSFT May 27 '22 at 10:04
  • 1
    @Sayali-MSFT that one still requires me to know the team guid, which is exactly what i am trying to get. – Cine May 27 '22 at 15:43
  • @Sayali-MSFT I found the solution, as you can see in my answer below. – Cine Jun 02 '22 at 08:10

1 Answers1

2

It seems DialogContext.Activity.TeamsGetTeamInfo() only returns the information given from the payload, and the default from Teams is to NOT include the AadGroupId.

There is however an 'active' version of the same await TeamsInfo.GetTeamDetailsAsync(dc.Context). This will return the full object.

Cine
  • 4,255
  • 26
  • 46