Ale*_*lex 6 python azure microsoft-teams
使用python,并拥有天蓝色的applicationID/objectID/tenantID/clientID和clientSecret,我想使用例如访问“团队”会议requests来获取正在进行的团队会议的参与者列表。msgraph现有模块和非现有模块(例如、msgraph-sdk和 )之间似乎存在很多混淆msgraph-sdk-python。它们似乎都不起作用,或者它们的作用不同。
我很欣赏一个实际有效的 Python 小代码片段,我可以用它来获取正在进行的 Teams 通话的参与者列表。
我有一个像下面这样的代码不起作用:
from microsoftgraph.client import Client
client = Client(client_id, client_secret, account_type='common')
# Make a GET request to obtain the list of participants
call_id = '123 456 789'
response = client.get(f'/communications/calls/{call_id}/participants', headers={'Authorization': f'Bearer {access_token}'})
participants = response.json()
Run Code Online (Sandbox Code Playgroud)
错误:
AttributeError:“Client”对象没有属性“get”
我还发现了这份快速入门指南,不幸的是我必须请求访问权限,而且我不知道是否有人会回复我的请求。
您可以使用下面的python 代码来获取团队通话的参与者列表:
#pip install azure.identity
#pip install msgraph.core
#pip install json_extract
from azure.identity import ClientSecretCredential
from msgraph.core import GraphClient
credential = ClientSecretCredential(tenant_id='tenantID',client_secret='secret',client_id='appID')
client = GraphClient(credential=credential)
result = client.get('/communications/calls/<callID>/participants')
print(result.json())
Run Code Online (Sandbox Code Playgroud)
我注册了一个 Azure AD 应用程序并授予API permissions如下:

最初,我运行下面的代码来获取有关调用的详细信息,如下所示:
from azure.identity import ClientSecretCredential
from msgraph.core import GraphClient
credential = ClientSecretCredential(tenant_id='tenantID',client_secret='secret',client_id='appID')
client = GraphClient(credential=credential)
result = client.get('/communications/calls/<callID>/')
print(result.json())
Run Code Online (Sandbox Code Playgroud)
回复:

同样,您可以运行下面的 python 代码来获取团队通话的参与者列表:
from azure.identity import ClientSecretCredential
from msgraph.core import GraphClient
credential = ClientSecretCredential(tenant_id='tenantID',client_secret='secret',client_id='appID')
client = GraphClient(credential=credential)
result = client.get('/communications/calls/<callID>/participants')
print(result.json())
Run Code Online (Sandbox Code Playgroud)
回复:

参考:
| 归档时间: |
|
| 查看次数: |
910 次 |
| 最近记录: |