English 中文(简体)
在建立管理系统小组时,使用微软图普软件在伙伴关系中举行会议。 C#网络网络
原标题:Error when creating a MS Teams meeting using Microsoft Graph API in an ASP.NET Web API in C#

我目前正在开发一个伙伴关系。 NET 有助于设立小组会议和检索URL链接的网播。 我一直关注微软的文件,但似乎不完整,我正遇到许多错误。

我在一份普通照会中添加了一个编号:OnlineMeetings。 阅读。 所有。 我应该能够同时建立多种联系,而不使用一个通用账户。 我只想授权我的资源来创造会议。

var tenantId = "...";
var clientId = "...";
var clientSecret = "...";

var options = new TokenCredentialOptions
{
    AuthorityHost = AzureAuthorityHosts.AzurePublicCloud,
};

var clientSecretCredential = new ClientSecretCredential(tenantId, clientId, clientSecret, options);

var graphClient = new GraphServiceClient(clientSecretCredential);

var requestBody = new Microsoft.Graph.Users.Item.OnlineMeetings.CreateOrGet.CreateOrGetPostRequestBody
{
    StartDateTime = DateTimeOffset.Parse("2024-02-20T14:30:00.2444915-07:00"),
    EndDateTime = DateTimeOffset.Parse("2024-02-20T15:00:00.2464912-07:00"),
    Subject = "Test meeting from graph API",
    Participants = new MeetingParticipants
    {
        Organizer = new MeetingParticipantInfo
        {
            Identity = new IdentitySet
            {
                User = new Identity
                {
                    Id = "[email protected]"
                }
            },
            Upn = "[email protected]"
        },
        Attendees = new List<MeetingParticipantInfo>
        {
            new MeetingParticipantInfo
            {
                Identity = new IdentitySet
                {
                    User = new Identity
                    {
                        Id = "[email protected]"
                    }
                },
                Upn = "[email protected]"
            }
        }
    }
};

var result = await graphClient.Users["[email protected]"].OnlineMeetings.CreateOrGet.PostAsync(requestBody);
return result.JoinWebUrl;

在以特定全权证书执行该守则时,我正在发现这一错误:

微软.Graph.Models.ODataErrors.ODataError

缩略语

这一例外最初被推向这一呼吁中:

Library.Http.HttpClientRequestAdapter.ThrowIfFailedResponse(System.Net.Http.HttpResponseMessage, System.Collections.Generic.Dictionary<string, Library.Abstractions.Serialization.ParsableFactory<Library.Abstractions.Serialization.IParsable>>, System.Diagnostics.Activity, System.Threading.CancellationToken)
Library.Http.HttpClientRequestAdapter.SendAsync(Library.Abstractions.RequestInformation, Library.Abstractions.Serialization.ParsableFactory, System.Collections.Generic.Dictionary<string, Library.Abstractions.Serialization.ParsableFactory<Library.Abstractions.Serialization.IParsable>>, System.Threading.CancellationToken)
Library.Http.HttpClientRequestAdapter.SendAsync(Library.Abstractions.RequestInformation, Library.Abstractions.Serialization.ParsableFactory, System.Collections.Generic.Dictionary<string, Library.Abstractions.Serialization.ParsableFactory<Library.Abstractions.Serialization.IParsable>>, System.Threading.CancellationToken)
Users.Item.OnlineMeetings.CreateOrGet.CreateOrGetRequestBuilder.PostAsync(Users.Item.OnlineMeetings.CreateOrGet.CreateOrGetPostRequestBody, System.Action<Library.Abstractions.RequestConfiguration<Library.Abstractions.DefaultQueryParameters>>, System.Threading.CancellationToken) in CreateOrGetRequestBuilder.cs
App.Services.MeetingGeneratorService.CreateMeeting(App.Dto.v2.MeetingDto) in MeetingGeneratorService.cs

问题回答

根据您的代码graphClient.Users[“[email Protect]]。 然后,请见APIC文件中的许可信息,它表明,>Application 的许可类型没有得到支持,这意味着我们是能够使用,以便获得(resssss) 然后,申请类型的许可就称为该文体。 然而,我们可以看到,你正在使用客户的密码——和;<代码> 用户SecretCredential = 新的客户Secretential

作为一种工作,我们可以使用举行在线会议,支持申请许可。 要求增加申请类型许可<代码>。 I ,在之前测试,以证明这份意向书能够解决你的问题。 《刑法》应当如下。

// Code snippets are only available for the latest version. Current version is 5.x
using Microsoft.Graph.Models;
using Microsoft.Graph;
using Azure.Identity;

var requestBody = new Event
{
    Subject = "Let s go for lunch",
    Body = new ItemBody
    {
        ContentType = BodyType.Html,
        Content = "Does next month work for you?",
    },
    Start = new DateTimeTimeZone
    {
        DateTime = "2019-03-10T12:00:00",
        TimeZone = "Pacific Standard Time",
    },
    End = new DateTimeTimeZone
    {
        DateTime = "2019-03-10T14:00:00",
        TimeZone = "Pacific Standard Time",
    },
    Location = new Location
    {
        DisplayName = "Harry s Bar",
    },
    Attendees = new List<Attendee>
    {
        new Attendee
        {
            EmailAddress = new EmailAddress
            {
                Address = "[email protected]",
                Name = "Adele Vance",
            },
            Type = AttendeeType.Required,
        },
    },
    IsOnlineMeeting = true,
    OnlineMeetingProvider = OnlineMeetingProviderType.TeamsForBusiness,
};

var scopes = new[] { "https://graph.microsoft.com/.default" };
var tenantId = "tenantId";
var clientId = "clientId";
var clientSecret = "clientSecret";
var clientSecretCredential = new ClientSecretCredential(
                tenantId, clientId, clientSecret);
var graphClient = new GraphServiceClient(clientSecretCredential, scopes);
var result = await graphClient.Users["{user_id}"].Events.PostAsync(requestBody);




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签