事件未在同一呼叫中为多个用户创建应用程序许可

发布于 2025-02-11 09:22:05 字数 5417 浏览 1 评论 0 原文

我已经在Azure Directory中注册了该应用程序的应用程序,并且可以通过一次为单个用户使用相同的令牌来获取令牌并安排事件,但是当我添加多个参与者时(

GraphServiceClient(accessToken).Users["[email protected]"].Events.Request().AddAsync(@event);

“ __cf_email__” data-cfemail = “ 交付未能输入这些接收者或组:

我在邮件中还遇到了一些错误,以获取

管理员的诊断信息:

生成服务器:SA0PR19MB4602.NAMPRD19.PROD.OUTLOOD.com

[email  procepted] 远程服务器返回'550 5.7.501服务不可用。从IP范围检测到垃圾邮件滥用。有关更多信息,请转到 http://go.microsoft.com/fwlink/?linkid = linkid= 526653 。 S(2017052602)[BYAPR19MB3063.NAMPRD19.PROD.OUTLOOK.com]'

原始消息标头:

Received: from SA0PR19MB4602.namprd19.prod.outlook.com
 ([fe80::d4d8:a608:e081:3249]) by SA0PR19MB4602.namprd19.prod.outlook.com
 ([fe80::d4d8:a608:e081:3249%7]) with mapi id 15.20.5373.018; Tue, 28 Jun 2022
 13:43:23 +0000
MIME-Version: 1.0
Content-Type: text/plain
Date: Tue, 28 Jun 2022 13:43:23 +0000
Message-ID:
    <SA0PR19MB4602896A05ED8C22B925567688B89@SA0PR19MB4602.namprd19.prod.outlook.com>
Subject: Schedule From .Net

代码

public static async Task<Event> CreateEvent(string accessToken)
        {
            Event event1 = new Event();
            var @event = new Event
            {
                Subject = "Schedule From .Net",
                Body = new ItemBody
                {
                    ContentType = BodyType.Html,
                    Content = "Test Schedule"
                },
                Start = new DateTimeTimeZone
                {
                    DateTime = "2022-07-10T12:00:00",
                    TimeZone = "Pacific Standard Time"
                },
                End = new DateTimeTimeZone
                {
                    DateTime = "2022-07-10T14:00:00",
                    TimeZone = "Pacific Standard Time"
                },
                Location = new Location
                {
                    DisplayName = "OR1"
                },
                Attendees = new List<Attendee>()
                    {
                        new Attendee
                        {
                            EmailAddress = new EmailAddress
                            {
                                Address = "[email protected]",
                                Name = "Vinay"
                            },
                            Type = AttendeeType.Required
                        },
                        new Attendee
                        {
                            EmailAddress = new EmailAddress
                            {
                                Address = "[email protected]",
                                Name = "Adelev"
                            },
                            Type = AttendeeType.Required
                        }
                    },
                TransactionId = Guid.NewGuid().ToString()
            };

            try
            {
                event1 = await GraphServiceClient(accessToken).Users["[email protected]"].Events.Request().AddAsync(@event);
               
            }
            catch (Exception ex)
            {

            }

            return event1;
        }

可以检查并建议我们如何通过使用相同时间在您同时安排多个用户。

是否有任何选项可以更改以下代码以在用户中添加多个电子邮件[]数组中

GraphServiceClient(accessToken).Users["[email protected]"].Events.Request().AddAsync(@event);

GraphServiceClient(accessToken).Users["[email protected],[email protected]"].Events.Request().AddAsync(@event);

但这会出现错误,如下所示

Code: ResourceNotFound
Message: Resource could not be discovered.
Inner error:
    AdditionalData:
    date: 2022-06-28T14:41:33
    request-id: 41cf2d89-de6d-44df-b42f-1e11d2fe430e
    client-request-id: 41cf2d89-de6d-44df-b42f-1e11d2fe430e
ClientRequestId: 41cf2d89-de6d-44df-b42f-1e11d2fe430e

,请建议我们必须以哪种方式呼叫

。 Srikanth

I have registered the App with application permission in Azure Directory and I am able to get Token and schedule a event by using the Same token for the single User at a time, but when I add the multiple Attendees ([email protected],[email protected]) in the list then it's not creating the meeting for another user which I have not mentioned in the

GraphServiceClient(accessToken).Users["[email protected]"].Events.Request().AddAsync(@event);

and am receiving the email saying
Delivery has failed to these recipients or groups:
[email protected]
Your message wasn't delivered because the recipient's email provider rejected it.

and I also got Some Error in the mail for

Diagnostic information for administrators:

Generating server: SA0PR19MB4602.namprd19.prod.outlook.com

[email protected]
Remote Server returned '550 5.7.501 Service unavailable. Spam abuse detected from IP range. For more information please go to http://go.microsoft.com/fwlink/?LinkId=526653. S(2017052602) [BYAPR19MB3063.namprd19.prod.outlook.com]'

Original message headers:

Received: from SA0PR19MB4602.namprd19.prod.outlook.com
 ([fe80::d4d8:a608:e081:3249]) by SA0PR19MB4602.namprd19.prod.outlook.com
 ([fe80::d4d8:a608:e081:3249%7]) with mapi id 15.20.5373.018; Tue, 28 Jun 2022
 13:43:23 +0000
MIME-Version: 1.0
Content-Type: text/plain
Date: Tue, 28 Jun 2022 13:43:23 +0000
Message-ID:
    <SA0PR19MB4602896A05ED8C22B925567688B89@SA0PR19MB4602.namprd19.prod.outlook.com>
Subject: Schedule From .Net

Code

public static async Task<Event> CreateEvent(string accessToken)
        {
            Event event1 = new Event();
            var @event = new Event
            {
                Subject = "Schedule From .Net",
                Body = new ItemBody
                {
                    ContentType = BodyType.Html,
                    Content = "Test Schedule"
                },
                Start = new DateTimeTimeZone
                {
                    DateTime = "2022-07-10T12:00:00",
                    TimeZone = "Pacific Standard Time"
                },
                End = new DateTimeTimeZone
                {
                    DateTime = "2022-07-10T14:00:00",
                    TimeZone = "Pacific Standard Time"
                },
                Location = new Location
                {
                    DisplayName = "OR1"
                },
                Attendees = new List<Attendee>()
                    {
                        new Attendee
                        {
                            EmailAddress = new EmailAddress
                            {
                                Address = "[email protected]",
                                Name = "Vinay"
                            },
                            Type = AttendeeType.Required
                        },
                        new Attendee
                        {
                            EmailAddress = new EmailAddress
                            {
                                Address = "[email protected]",
                                Name = "Adelev"
                            },
                            Type = AttendeeType.Required
                        }
                    },
                TransactionId = Guid.NewGuid().ToString()
            };

            try
            {
                event1 = await GraphServiceClient(accessToken).Users["[email protected]"].Events.Request().AddAsync(@event);
               
            }
            catch (Exception ex)
            {

            }

            return event1;
        }

Can anybody can you please check and suggest how we can schedule for multiple users at thee same time by using the same.

is there any option to change below code to add multiple emails in Users[] array

GraphServiceClient(accessToken).Users["[email protected]"].Events.Request().AddAsync(@event);

to

GraphServiceClient(accessToken).Users["[email protected],[email protected]"].Events.Request().AddAsync(@event);

but this gives error as below

Code: ResourceNotFound
Message: Resource could not be discovered.
Inner error:
    AdditionalData:
    date: 2022-06-28T14:41:33
    request-id: 41cf2d89-de6d-44df-b42f-1e11d2fe430e
    client-request-id: 41cf2d89-de6d-44df-b42f-1e11d2fe430e
ClientRequestId: 41cf2d89-de6d-44df-b42f-1e11d2fe430e

can please suggest which way we have to call

Regards
Srikanth

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

じ违心 2025-02-18 09:22:06

抱歉,请按照下面的代码进行测试。

我仔细确认了您的代码,并检查了官方API文档,我注意到您所写的是等待GraphServiceClient(accessToken).uSers [users ['等待GraphClient.me.calendars [“ {calendar-id}”]。events.request()。addAsync(@event); ,因此您可能需要使用代码 graphServServiceClient(AccessToken).users [users [users [users] “ 而不是。

public void CreateEvent()
{
    var scopes = new[] { "https://graph.microsoft.com/.default" };
    var tenantId = "your_tenant_name.onmicrosoft.com";
    var clientId = "azure_ad_app_id";
    var clientSecret = "client_secret";
    var clientSecretCredential = new ClientSecretCredential(
        tenantId, clientId, clientSecret);
    var graphClient = new GraphServiceClient(clientSecretCredential, scopes);
    
    var @event = new Event
    {
        Subject = "Schedule From .Net",
        Body = new ItemBody
        {
            ContentType = BodyType.Html,
            Content = "Test Schedule"
        },
        Start = new DateTimeTimeZone
        {
            DateTime = "2022-07-10T12:00:00",
            TimeZone = "Pacific Standard Time"
        },
        End = new DateTimeTimeZone
        {
            DateTime = "2022-07-10T14:00:00",
            TimeZone = "Pacific Standard Time"
        },
        Location = new Location
        {
            DisplayName = "OR1"
        },
        Attendees = new List<Attendee>()
            {
                new Attendee
                {
                    EmailAddress = new EmailAddress
                    {
                        Address = "[email protected]",
                        Name = "Vinay"
                    },
                    Type = AttendeeType.Required
                },
                new Attendee
                {
                    EmailAddress = new EmailAddress
                    {
                        Address = "[email protected]",
                        Name = "Adelev"
                    },
                    Type = AttendeeType.Required
                }
            },
        TransactionId = Guid.NewGuid().ToString()
    };
    var res = await graphClient.Users["userId"].Calendars["{calendar-id}"].Events.Request().AddAsync(@event);
}

Sorry pls follow the code below and have a test.

I double confirmed your code and checked the official api document, I noticed that what you wrote is await GraphServiceClient(accessToken).Users["[email protected]"].Events.Request().AddAsync(@event) while the sample code is await graphClient.Me.Calendars["{calendar-id}"].Events.Request().AddAsync(@event);, so you may need to use code GraphServiceClient(accessToken).Users["[email protected]"].Calendars["{calendar-id}"].Events.Request().AddAsync(@event); instead.

public void CreateEvent()
{
    var scopes = new[] { "https://graph.microsoft.com/.default" };
    var tenantId = "your_tenant_name.onmicrosoft.com";
    var clientId = "azure_ad_app_id";
    var clientSecret = "client_secret";
    var clientSecretCredential = new ClientSecretCredential(
        tenantId, clientId, clientSecret);
    var graphClient = new GraphServiceClient(clientSecretCredential, scopes);
    
    var @event = new Event
    {
        Subject = "Schedule From .Net",
        Body = new ItemBody
        {
            ContentType = BodyType.Html,
            Content = "Test Schedule"
        },
        Start = new DateTimeTimeZone
        {
            DateTime = "2022-07-10T12:00:00",
            TimeZone = "Pacific Standard Time"
        },
        End = new DateTimeTimeZone
        {
            DateTime = "2022-07-10T14:00:00",
            TimeZone = "Pacific Standard Time"
        },
        Location = new Location
        {
            DisplayName = "OR1"
        },
        Attendees = new List<Attendee>()
            {
                new Attendee
                {
                    EmailAddress = new EmailAddress
                    {
                        Address = "[email protected]",
                        Name = "Vinay"
                    },
                    Type = AttendeeType.Required
                },
                new Attendee
                {
                    EmailAddress = new EmailAddress
                    {
                        Address = "[email protected]",
                        Name = "Adelev"
                    },
                    Type = AttendeeType.Required
                }
            },
        TransactionId = Guid.NewGuid().ToString()
    };
    var res = await graphClient.Users["userId"].Calendars["{calendar-id}"].Events.Request().AddAsync(@event);
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文