无法使用附件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日历时将文件附加到日历事件,但是收件人没有任何附件。问题是根据ID添加附件创建的第一个事件,因此

参考链接https://github.com/officedev/o365-aspnetmvc-start

您可以建议我如何处理这个问题。

谢谢hemanth。

添加附件后,需要更新事件。例如,我们可以更改以下事件的身体:

    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();

最新更新