1

Hi I'm trying to get the events from the room mailbox using graph client. Like we retrieve events from the user calendar as follows.

   var queryOptions = new List<QueryOption>()
            {
                   new QueryOption("startDateTime", startDateTime),
                   new QueryOption("endDateTime", endDateTime)
            };

   var calendarView = await graphClient.Users[{user_id}].CalendarView
            .Request(queryOptions)
            .GetAsync();

Is there any way to fetch events from the room calendar using graph client.

Any help is appreciated.

Sumith Jose
  • 167
  • 8

1 Answers1

0

You can try this:

GraphServiceClient graphClient = new GraphServiceClient( authProvider );

var schedules = new List<String>()
{
    "roommailboxone@domain.onmicrosoft.com"
};

var startTime = new DateTimeTimeZone
{
    DateTime = "2020-09-11T09:00:00",
    TimeZone = "Pacific Standard Time"
};

var endTime = new DateTimeTimeZone
{
    DateTime = "2020-09-11T18:00:00",
    TimeZone = "Pacific Standard Time"
};

var availabilityViewInterval = 60;

await graphClient.Me.Calendar
    .Getschedule(schedules,endTime,startTime,availabilityViewInterval)
    .Request()
    .PostAsync();

It works for me. Here's the output:

enter image description here

Dev
  • 2,428
  • 2
  • 14
  • 15
  • 1
    Hi @dev, Thanks for sharing this, But this only returns the events in the specified room of a particular user that you are requesting. Actually my requirement is to get all events that happened in that room. The events might be created by different users. ie the room may contain various events created by different users. I need all those events from the room calendar. – Sumith Jose Sep 13 '20 at 10:01
  • Then you need to query the room calendar and you can get it. – Dev Nov 09 '20 at 19:18
  • that doesnt work ! it throws undefined resource id as response – Murtuza Husain May 04 '21 at 20:54
  • The above scenario tells its not issue with API, rather may be with room configured. First you need to validate whether the given resource id is allocated for Room mailbox and its properly configured as well. – Dev May 05 '21 at 03:42