Forum Discussion

faaz's avatar
faaz
Frequent Visitor
11 months ago
Solved

Extracting Teams call info using Graph API

Hi. I am currently trying to extract Teams call information using Graph API. I've managed to get information about the call organizer as well as duration of teh call etc. Afterwards, for each call ID...
  • nielsvdc's avatar
    nielsvdc
    11 months ago

    If you create a new ADF dataset and call the dataset Graph_Teams_ListParticipant, you can past the code below to get an idea of how to configure the dataset.

     

    Dataset code:

     

    {"name": "Graph_Teams_ListParticipant", "properties": {"annotations": [], "linkedServiceName": {"referenceName": "GraphAPI", "type": "LinkedServiceReference"}, "parameters": {"call_id": {"type": "string"}}, "schema": {}, "type": "Json", "typeProperties": {"location": {"relativeUrl": {"type": "Expression", "value": "\"/communications/calls/@{dataset().call_id}/participants\""}, "type": "HttpServerLocation"}}}}

     

     

    If you create a new ADF pipeline and call it pipeline1, you can past the code below to get an idea of how to configure the pipeline to loop through each call and get the participants. With the Copy data action correctly configured to retreive the API participants data, it should be able to sink it into a table and let the action create a destination table.

     

    Pipeline code:

    {"name": "pipeline1", "properties": {"activities": [{"dependsOn": [], "name": "Set call ouput variable", "policy": {"secureInput": false, "secureOutput": false}, "type": "SetVariable", "typeProperties": {"value": {"type": "Expression", "value": "@json(variables('call_example')).value"}, "variableName": "calls"}, "userProperties": []}, {"dependsOn": [{"activity": "Set call ouput variable", "dependencyConditions": ["Succeeded"]}], "name": "ForEach call ID", "type": "ForEach", "typeProperties": {"activities": [{"dependsOn": [{"activity": "Set call_id variable", "dependencyConditions": ["Succeeded"]}], "inputs": [{"parameters": {"call_id": {"type": "Expression", "value": "@variables('call_id')"}}, "referenceName": "Graph_Teams_ListParticipant", "type": "DatasetReference"}], "name": "Copy data1", "onInactiveMarkAs": "Succeeded", "policy": {"retry": 0, "retryIntervalInSeconds": 30, "secureInput": false, "secureOutput": false, "timeout": "0.12:00:00"}, "state": "Inactive", "type": "Copy", "typeProperties": {"enableStaging": false, "source": {"formatSettings": {"type": "JsonReadSettings"}, "storeSettings": {"requestMethod": "GET", "type": "HttpReadSettings"}, "type": "JsonSource"}}, "userProperties": []}, {"dependsOn": [], "name": "Set call_id variable", "policy": {"secureInput": false, "secureOutput": false}, "type": "SetVariable", "typeProperties": {"value": {"type": "Expression", "value": "@item().id"}, "variableName": "call_id"}, "userProperties": []}], "items": {"type": "Expression", "value": "@variables('calls')"}}, "userProperties": []}], "annotations": [], "variables": {"call_example": {"defaultValue": "{\"@odata.context\": \"https://graph.microsoft.com/v1.0/$metadata#communications/callRecords\", \"value\": [{\"endDateTime\": \"2023-09-25T09:28:41Z\", \"id\": \"3cf3bbc8-b21d-4f2e-bfd0-b13603ae6c65\", \"lastModifiedDateTime\": \"2023-09-25T10:36:40Z\", \"modalities\": [\"audio\"], \"organizer\": {\"user\": {\"displayName\": \"Abbie Wilkins\", \"id\": \"821809f5-0000-0000-0000-3b5136c0e777\", \"tenantId\": \"dc368399-474c-4d40-900c-6265431fd81f\"}}, \"organizer_v2\": {\"id\": \"821809f5-0000-0000-0000-3b5136c0e777\", \"identity\": {\"user\": {\"displayName\": \"Abbie Wilkins\", \"id\": \"821809f5-0000-0000-0000-3b5136c0e777\", \"tenantId\": \"dc368399-474c-4d40-900c-6265431fd81f\"}}}, \"[email protected]\": \"https://graph.microsoft.com/v1.0/$metadata#communications/callRecords('3cf3bbc8-b21d-4f2e-bfd0-b13603ae6c65')/organizer_v2/$entity\", \"startDateTime\": \"2023-09-25T09:28:38Z\", \"type\": \"unknown\", \"version\": 2}, {\"endDateTime\": \"2023-09-25T14:03:40Z\", \"id\": \"c3ad8c4b-4a87-4ab1-bef0-284d2f40ed9f\", \"lastModifiedDateTime\": \"2023-09-25T14:18:13Z\", \"modalities\": [\"audio\"], \"organizer\": {\"user\": {\"displayName\": \"Abbie Wilkins\", \"id\": \"821809f5-0000-0000-0000-3b5136c0e777\", \"tenantId\": \"dc368399-474c-4d40-900c-6265431fd81f\"}}, \"organizer_v2\": {\"id\": \"+5564981205182\", \"identity\": {\"acsUser\": null, \"phone\": {\"displayName\": null, \"id\": \"+5564981205182\", \"tenantId\": null}, \"spoolUser\": null, \"user\": null}}, \"[email protected]\": \"https://graph.microsoft.com/v1.0/$metadata#communications/callRecords('c3ad8c4b-4a87-4ab1-bef0-284d2f40ed9f')/organizer_v2/$entity\", \"startDateTime\": \"2023-09-25T14:03:36Z\", \"type\": \"unknown\", \"version\": 2}]}", "type": "String"}, "call_id": {"type": "String"}, "calls": {"type": "Array"}}}}

     

    Hope this helps. If so, please give a Kudos 👍 and mark as Accepted Solution ✔️.