Home » c# » .net – how can filter data of calender in c# according to room names?-Exceptionshub

.net – how can filter data of calender in c# according to room names?-Exceptionshub

Posted by: admin February 24, 2020 Leave a comment

Questions:

How can I filter my events of outlook according to room name?

var queryOptions1 = new List<QueryOption>()
{
  new QueryOption("startDateTime", starttimeluis ),
  new QueryOption("endDateTime", Endtimeluis)

};
var calendarView1 = await graphClient.Me.Calendar.CalendarView
                            .Request(queryOptions1)
                            .GetAsync();

I want to filter calendar event data according to room name, how to do a query in c#.net?

How to&Answers:

You could try following code snippet

GraphServiceClient graphClient = new GraphServiceClient( authProvider );

var findRooms = await graphClient.Me
    .FindRooms("[email protected]")
    .Request()
    .GetAsync();

As it is Microsoft Graph beta version so you have install Microsoft.Graph.Beta package. See the below screen shot

enter image description here

For more details please refer to official docs

Update:

You could $filter your query like this format:

            HttpClient client = new HttpClient();

            HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, "https://graph.microsoft.com/v1.0/me/mailFolders/inbox/messages?$filter=ReceivedDateTime ge 2017-04-01 and receivedDateTime lt 2017-05-01");

            request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", "eyJ0eXAiOiJKV1QiLCJub25jZSI6IkFRQUJBQUFB");
            HttpResponseMessage response = await client.SendAsync(request);

            string output = await response.Content.ReadAsStringAsync();