无法发送带有附件 O365-ASPNETMVC 的日历事件请求

Not able to Send calendar event Request with attachment O365-ASPNETMVC

我正在尝试向日历添加附件。因为它需要事件 ID,所以我无法使用方法 AddCalendarEventAsync 添加。所以我正在尝试下面的代码:\

var outlookServicesClient = await AuthenticationHelper.EnsureOutlookServicesClientCreatedAsync("Calendar");
                             await outlookServicesClient.Me.Calendar.Events.AddEventAsync(newEvent);
                var thisEventFetcher = outlookServicesClient.Me.Calendar.Events.GetById(newEvent.Id);               
                await thisEventFetcher.Attachments.AddAttachmentAsync(attachments[0]);

当我打开 365 office 日历时,文件附加到日历事件,但收件人没有收到任何 attachment.The 问题是根据 Id 添加附件后创建的第一个事件, 所以在执行 AddAttachmentAsync 方法之前,邮件会发送给收件人。

Ref link https://github.com/OfficeDev/O365-ASPNETMVC-Start

你能建议我如何处理这个问题吗?

谢谢, 赫曼斯

组织者添加附件后,需要更新活动。例如,我们可以像下面这样更改事件的主体:

    await thisEventFetcher.Attachments.AddAttachmentAsync(fileAttach);
        IEvent eventToUpdate =await thisEventFetcher.ExecuteAsync();

        ItemBody newBody = new ItemBody
        {
            Content = "Status updates, blocking issues, and next steps.(Update)",
            ContentType = BodyType.Text
        };
        eventToUpdate.Body=newBody;

        await eventToUpdate.UpdateAsync();