-
Notifications
You must be signed in to change notification settings - Fork 263
Description
Describe the bug
var queryOptions = new List<QueryOption>
{
new QueryOption("startDateTime", startTime.ToString("o")),
new QueryOption("endDateTime", endTime.ToString("o"))
};
// Get calendar events for the specified user and time window
var events = await graphClient.Users[email]
.Calendar
.CalendarView
.Request(queryOptions).Top(900)
.GetAsync();
public class GraphAuthenticationProvider : IAuthenticationProvider
{
private readonly IConfidentialClientApplication _clientApp;
private readonly string[] _scopes;
public GraphAuthenticationProvider(string clientId, string tenantId, string clientSecret, string[] scopes)
{
_clientApp = ConfidentialClientApplicationBuilder.Create(clientId)
.WithTenantId(tenantId)
.WithClientSecret(clientSecret)
.Build();
_scopes = scopes;
}
public async System.Threading.Tasks.Task AuthenticateRequestAsync(HttpRequestMessage request)
{
await _clientApp.AcquireTokenForClient(_scopes).ExecuteAsync();
}
}
Microsoft Graph( v4.x) is getting authenticated properly but when running the API to get the calendar events using the code given above, I am getting the error : "Code: generalException
Message: An error occurred sending the request."
and "System.AggregateException: One or more errors occurred. ---> Microsoft.Graph.ServiceException: Code: generalException
Message: Unexpected exception returned from the service.
ClientRequestId: 09f6cdf7-ed58-4714-80a6-03c8c6964692"
this error is coming in AuthenticateRequestAsync() method when trying to get the calendar events.
I am using .Net framework version 4.7.2
This is not a problem with Microsoft.Graph dotnet v3.x
This is not a problem with Visual Studio 2019.
Expected behavior
I should be able to get the calendar events with Microsoft Graph version 4.x
How to reproduce
Authenticate the Microsoft graph with version 4.x
try to get the calendar events using the code mentioned above on the .Net framework 4.7.2
SDK Version
4.28
Latest version known to work for scenario above?
3.x
Known Workarounds
No response
Debug output
Click to expand log
```</details>
### Configuration
- OS: windows server 2019
- architecture: x86
### Other information
_No response_