microsoftgraph / microsoftgraph/msgraph-sdk-dotnet
Microsoft Graph Api Integration issue
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 789
- Forks
- 264
- Avg merge
- 15h 17m
- Merged PRs (30d)
- 3
Description
We want to use Microsoft Graph Api (Outlook.Calendar this Api endpoint : https://graph.microsoft.com/v1.0/me/events?$select=subject,body,bodyPreview,organizer,attendees,start,end,location) with all the required configuration related to azure.
The below is our console app code, in future we move our console app to Background Service
try
{
var credential = new ClientSecretCredential(TenantId, ClientId, ClientSecret);
var authProvider = new AzureIdentityAuthenticationProvider(
credential,
scopes: ["https://graph.microsoft.com/.default"],
isCaeEnabled: false
);
var graphClient = new GraphServiceClient(authProvider);
string userIdentifier = "our user identity";
var events = await graphClient.Users[userIdentifier].Events
.GetAsync(requestConfig =>
{
requestConfig.QueryParameters.Select = new[] {
"subject", "bodyPreview", "organizer", "start", "end", "location"
};
requestConfig.QueryParameters.Top = 10;
});
Console.WriteLine($"Success! Found {events?.Value?.Count ?? 0} events.");
}
catch (Exception ex)
{
Console.WriteLine($"Error: {ex.Message}");
Console.WriteLine($"Details: {ex.InnerException?.Message}");
Console.WriteLine("TIP: Check permissions, user ID format, and try disabling CAE");
}
}
This error is occurred : Microsoft.Kiota.Abstractions.ApiException: 'The server returned an unexpected status code and the error registered for this code failed to deserialize: 401'.
Can anyone have idea of this issue?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the console app code using ClientSecretCredential, AzureIdentityAuthenticationProvider, and GraphServiceClient, then review the Microsoft Graph /me/events endpoint and the Azure configuration mentioned in the report. Reproduce the 401 response and verify that the calendar request completes successfully with the requested event fields.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, csharp
- Domain
- api, authentication
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100