GraphClient, C# unable to fetch Appointments created in Outlook.

Unais Bakerhill 6 Reputation points
2021-01-07T09:57:12.317+00:00

I am using GraphServiceClient v1.0. With OAuth token.
I have Calendars.ReadWrite, Calendars.ReadWrite.Shared, User.Read permissions.
I use Calendars.ReadWrite scope for this request.

I am able to create and get Events and Tasks(using default task list).

Where I am struggling is to get the Appointments created in Outlook.

All the events/tasks created programmatically can be retrieved, but not the outlook created Appointments. I tried with Events and CalendarView but both return same results.

Am I missing something, or need to hit a different end point?. Here is the code

       var graphClient = new GraphServiceClient(baseUrl,
           new DelegateAuthenticationProvider(async (requestMessage) =>
           {
               requestMessage.Headers.Authorization = new AuthenticationHeaderValue("bearer", token);
           })
        ));



           var queryOptions = new System.Collections.Generic.List<Microsoft.Graph.QueryOption>()
                {
                    new Microsoft.Graph.QueryOption("startDateTime", "2020-12-06T19:00:00-08:00"),
                    new Microsoft.Graph.QueryOption("endDateTime", "2020-12-07T19:00:00-08:00")
                };

                var calendarView = await graphClient.Me.CalendarView
                    .Request(queryOptions)
                    .GetAsync();

               var meetingEvents = await graphClient.Me.Events
                .Request()
                .GetAsync();

              var tasks = await graphClient.Me.Todo.Lists[taskListId].Tasks
                .Request().Top(20)
                .GetAsync();

            // And I am combining both the results (meetingEvents,  tasks) to obtain final list of entire tasks

Thanks in advance.

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,687 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Deva-MSFT 2,261 Reputation points Microsoft Employee
    2021-01-08T05:56:56.793+00:00

    I tested the above Graph API call in Microsoft Graph Explorer and POSTMAN, which works. So i dont think its issue with Graph API call. Just to isolate the issue, I would suggest you to test the code individually for tasks and events to see if it helps.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.