让 Teams Calls 返回未在我们商店注册的应用程序

Getting Teams Calls returns Application not registered in our store(让 Teams Calls 返回未在我们商店注册的应用程序)
本文介绍了让 Teams Calls 返回未在我们商店注册的应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为 Microsft Graph 苦苦挣扎.我想从图形 API 中获取 Teams Calls,以将它们与我们的票务软件相冲突.一开始听起来很容易.我认为是,但我不明白为什么它不起作用.

I'm struggling with Microsft Graph. I want to fetch Teams Calls from the graph API to throw them against our ticket software. Sounds easy at first. And I think it is but I don't get why it won't work.

只是一个抬头.我最终使用了 Microsoft Graph 订阅模型.

Just a heads up. I ended up using the Microsoft Graph subscription model.

明确地说,我不想创建团队应用,我只想获取团队通话/会议.

To be clear, I don't want to create a teams app, I just want to fetch Teams Calls/Meetings.

这是我的代码(出于显而易见的原因删除了 ID):

This is my code (removed ID's for obvious reasons):

class Program
{
    // (Company IDs)
    static string tenantId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
    static string servicePrincipal = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
    static string servicePrincipalKey = "keyyyyy";

    // Admin consent if not already applied
    // https://login.microsoftonline.com/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/adminconsent?client_id=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx&state=randomState
    // In my case admin consent was given via azure portal for the following permissions:
    // Yes, it's too much. But I'm desperate...
    /* Microsoft Graph (10)
        CallRecords.Read.All
        Calls.AccessMedia.All
        ChannelMessage.Read.All
        Chat.Read.All
        IdentityProvider.Read.All
        OnlineMeetings.Read.All
        TeamsActivity.Read.All
        TeamsApp.Read.All
        User.Read.All 
    */

    static string[] scopes = {
        "https://graph.microsoft.com/.default",
        //"https://graph.microsoft.com/CallRecords.Read.All" // doesn't work
        //"https://graph.microsoft.com/TeamsApp.Read.All" // doesn't work
        //"https://graph.microsoft.com/Chat.ReadWrite.All" // doesn't work
    };
    static async Task Main(string[] args)
    {

        var authority = $"https://login.microsoftonline.com/" + "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" + "/v2.0";

        var clientConf = ConfidentialClientApplicationBuilder
            .Create(servicePrincipal)
            .WithAuthority(authority, true)
            .WithClientSecret(servicePrincipalKey)
            .Build();

        GraphServiceClient graphClient = new GraphServiceClient(new DelegateAuthenticationProvider(async(requestMessage) =>
        {
            var authResult = await clientConf
                .AcquireTokenForClient(scopes)
                .ExecuteAsync();
            requestMessage.Headers.Authorization = new AuthenticationHeaderValue("Bearer", authResult.AccessToken);
        }));

        //_ = graphClient.Teams.Request().GetAsync(); // Debug test

        // Trying to fetch all calls or meetings
        var onlineMeetings = await graphClient
            .Communications.Calls.Request().GetAsync(); // Doesn't work
        //.Users.Request().GetAsync(); // This works!
        //.Communications.OnlineMeetings.Request().GetAsync(); // Doesn't work

        Console.WriteLine(onlineMeetings);
        // If requesting users, this works without issues 
        /*
        var count = 0;
        foreach (var user in onlineMeetings) {
            Console.WriteLine(count);
            Console.WriteLine(user.UserPrincipalName);
            count++;
        }
        */

    }
}

当我运行这个烂摊子时,我得到了以下错误:

When I run this mess I get the follwing error:

"Microsoft.Graph.ServiceException in System.Private.CoreLib.dll"
Code: UnknownError
{
  "errorCode":"7503",
   "message":"`**Application is not registered in our store.**`",
   "instanceAnnotations":[]
}

有人知道我在这里做错了什么吗?

Does anyone have an idea on what I'm doing wrong here?

堆栈跟踪

ClientRequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
    at Microsoft.Graph.HttpProvider.<SendAsync>d__18.MoveNext()
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
    at Microsoft.Graph.BaseRequest.<SendRequestAsync>d__35.MoveNext()
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
    at Microsoft.Graph.BaseRequest.<SendAsync>d__31`1.MoveNext()
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
    at Microsoft.Graph.CloudCommunicationsCallsCollectionRequest.<GetAsync>d__4.MoveNext()
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
    at Teams_Graph.Program.<Main>d__4.MoveNext() in c:Users<user.name>DocumentsDevelopmentC#Teams-GraphProgram.cs: Line50

推荐答案

没有适用于 列出组织中的所有通话或会议.您需要指定您想要的通话/会议的id:

There isn't an API for listing all Calls or Meetings in an organization. You need to specify the id of the Call/Meeting you want:

var Calls = await graphClient
    .Communications
    .Calls["{call id}"]
    .Request()
    .GetAsync();

var onelineMeeting = await graphClient
    .Communications
    .OnlineMeetings["{meeting id"]
    .Request()
    .GetAsync();

这篇关于让 Teams Calls 返回未在我们商店注册的应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

DispatcherQueue null when trying to update Ui property in ViewModel(尝试更新ViewModel中的Ui属性时DispatcherQueue为空)
Drawing over all windows on multiple monitors(在多个监视器上绘制所有窗口)
Programmatically show the desktop(以编程方式显示桌面)
c# Generic Setlt;Tgt; implementation to access objects by type(按类型访问对象的C#泛型集实现)
InvalidOperationException When using Context Injection in ASP.Net Core(在ASP.NET核心中使用上下文注入时发生InvalidOperationException)
LINQ many-to-many relationship, how to write a correct WHERE clause?(LINQ多对多关系,如何写一个正确的WHERE子句?)