Forum Discussion

azhagirir's avatar
azhagirir
Copper Contributor
Apr 08, 2024

Updating meeting response status with microsoft graph

 

var meetingInfo = new Event
        {
            Subject = meetingBooking.Subject,
            OriginalStartTimeZone = meetingBooking.StartTime,
            OriginalEndTimeZone = meetingBooking.EndTime,
            Start = new DateTimeTimeZone
            {
                DateTime = meetingBooking.StartTime,
                TimeZone = _calendarProcessing.GetTimeZone(timeZoneCode!),
            },
            End = new DateTimeTimeZone
            {
                DateTime = meetingBooking.EndTime,
                TimeZone = _calendarProcessing.GetTimeZone(timeZoneCode!),
            },            
            IsOnlineMeeting = meetingBooking.IsOnlineAppointment == "true" ? true : false,
            ResponseStatus = new ResponseStatus
            {
                Response = ResponseType.Accepted,
                Time = DateTimeOffset.Now,
            },
            Recurrence = null,
        };
 
        var attendeeList = meetingBooking?.Attendees?.Select(x => new Attendee
        {
            EmailAddress = new EmailAddress
            {
                Address = x.EmailAddress,
                Name = x.Name
            }
        }).ToList();
 
        meetingInfo.Attendees = attendeeList;




string timeZone = $"outlook.timezone=\"{eventInfo?.Start?.TimeZone}\"";
 
        _graphServiceClient = InitializeGraph();
 
        var user = await _graphServiceClient!
                            .Users[emailAddress]
                            .GetAsync();
 
        var result = await _graphServiceClient!
                         .Users[user!.Id]                         
                         .Events[meetingId]
                         .PatchAsync(eventInfo!, (requestConfiguration) =>
                         {
                             requestConfiguration.Headers.Add("Prefer", timeZone);
                         });
        return result;

 

With this code I can't update the status from "NotResponded" to "Accepted" status. Please help in solving this issue. I am using client crediential to get the _graphServiceClient object.

 

No RepliesBe the first to reply

Resources