I am trying to write code to access Microsoft Calendar using Graph API
var calendars = await graphClient.Me.Calendars.Request().GetAsync();
List<string> calendarNames = new List<string>();
foreach (var calendar in calendars)
{
calendarNames.Add(calendar.Name);
}
I am facing strange problem.
var calendars = await graphClient.Me.Calendars.Request().GetAsync();
But compiler is throwing error saying "'CalendarsRequestBuilder' does not contain a definition for 'Request' "
I have nuget packages included
Microsoft.Graph Microsoft.Graph.Core Microsoft.Idendity.Client
I tried downgrading Graph library, but problem still remains.
The
Request()method is used in Graph SDK v4, the latest SDK v5 removed this method, so you can call directlyGetAsync()To get access token (based on your comment)
IAccessTokenProviderGetAuthorizationTokenAsynccreateIPublicClientApplicationNow, create a new authentication provider
Upgrade guide from v4 to v5