Using application permission on personal Microsoft account returns Microsoft.Kiota.Abstractions error

Roberto Escalera 25 Reputation points
2023-03-31T16:53:04.3633333+00:00

Code is something simple like:

var clientSecretCredential = new ClientSecretCredential(tenantId, clientId, clientSecret);
graphClient = new GraphServiceClient(clientSecretCredential);
var result = await graphClient.Users["user-id"].Calendar.GetAsync();

Application Permissions are User.Read.All, User.ReadWrite.All, Calendars.Read and Calendards.ReadWrite.

It gives me error: Microsoft.Kiota.Abstractions: Content type text/html does not have a factory registered to be parsed.

If I change the call to await graphClient.Users["user-id"].GetAsync() or await graphClient.Users["user-id"].Subscriptions.GetAsync(), it works.

This is on a personal Microsoft account. Not part of any organization. Is that the reason why?

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

Accepted answer
  1. Anonymous
    2023-04-04T05:16:29.5466667+00:00

    Hi @Roberto Escalera , Thanks for reaching out! As per my understanding, you are trying to fetch Calendar details for user/userId by using application permissions with the personal Microsoft account. Personal Microsoft accounts don’t support Applications permissions which require admin consent. And from the documentation, personal Microsoft account support only delegated permissions, you can refer more from here: User's image

    Using delegated permissions, one can access data for the signed in user. Hope this helps! If the reply is helpful, please click "Accept Answer" and kindly upvote it. If you have additional questions about this answer, please click "Comment".

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful