I am trying to update the following fields for an existing event but not updating as expected.
Fields we want to update:
- Add and Remove Attachments
- Update Subject and Body content.
- Add and/or Remove mandatory/optional attendees.
Using the following code to remove an attachment:
await graphClient
.Users[organizer]
.Events[organizerEventId]
.Attachments[attachmentId]
.Request()
.DeleteAsync()
.ConfigureAwait(false);
Using the following code to add an attachment:
var fileAttachment = new Microsoft.Graph.FileAttachment
{
ODataType = attachment.odataType,
Name = attachment.name,
ContentBytes = attachment.contentBytes,
ContentType = attachment.contentType
};
var response = await graphClient
.Users[organizer]
.Events[organizerEventId]
.Attachments
.Request()
.AddAsync(fileAttachment);
Using the following code to update attendees:
var updateEvent = new Microsoft.Graph.Event
{
Attendees = attendees
};
var resultUpdate = await graphClient
.Users[organizer]
.Events[organizerEventId]
.Request()
.UpdateAsync(updateEvent);
Using the following code to update Subject and Body content:
var updateEvent = new Microsoft.Graph.Event
{
HasAttachments = true,
ResponseRequested = false,
Subject = subject,
Body = body
};
var resultUpdate = await graphClient
.Users[organizer]
.Events[organizerEventId]
.Request()
.UpdateAsync(updateEvent);
I am executing the above codes in sequential order but when I debugged the code I observed that it only executes the first logic to remove attachment and call comes out without executing the remaining code logic written below in the same method.