question

PabloMartinez-1521 avatar image
1 Vote"
PabloMartinez-1521 asked ·

problem to get the token


9:42 p. m.
i created a user in the AD .
With this user I can connect in the AP and received the Token.
but I can access to the my calendar.
what is the problem? thanks

9:44 p. m.
I need to connect to my calendar with a windows service in .net c# . is possible? my account is pablo.martinez7908@gmail.com

9:48 p. m.
Microsoft identity platform scopes, permissions, and consent docs.microsoft.com Here's some documentation that may be able to help with confirming whether or not your application has the correct permissions set: https://aka.ms/d_VIhgan8D
Let us know if you're still having issues after following the steps listed in that documentation.

9:48 p. m.
the response of the request is this:
The client has requested access to a resource which is not listed in the requested permissions in the client's application registration

10:24 p. m.
I give all the permission, and accept the consent. but when i tried to connect with my user , the error is the same (copy in the other tweet I used this to get token https://login.microsoftonline.com{ {TenantID}}/oauth2/v2.0/token and is impossible to get it with my user (owner) why I cant get the token if I am the owner of the app?

10:28 p. m.
if I use the user I created in AD .. the token was generated.
but when I tried to connect to https://graph.microsoft.com/v1.0/me/calendars appears another error.
when I used postman with my user to get the token, the error is this:
AADSTS50034: The user account 59fcf3ac-b244-409f-bdef-c03d2391941e does not exist in the 25bc6bfa-6a6b-4d5d-bbe4-253998fcd6e2 directory. To sign into this application, the account must be added to the directory.\r\nTrace ID: c27dcac0-2b2b-4b45-b49e-846e5cd7ab00\r\nCorrelation ID: 5761f165-b349-4f73-81ba-d79c306d5fbf\r\nTimestamp: 2019-11-23 01:29:49Z", "error_codes": [ 50034 ], "timestamp": "2019-11-23 01:29:49Z", "trace_id": "c27dcac0-2b2b-4b45-b49e-846e5cd7ab00", "correlation_id": "5761f165-b349-4f73-81ba-d79c306d5fbf", "error_uri": "https://login.microsoftonline.com/error?code=50034"
im the owner of the application

10:31 p. m.
Can you provide us with your subscription ID?

10:38 p. m.
I don't have any subscription ID. I only have my account to login in Portal and the data of the applicattion created.

10:55 p. m.
he resources you have in Azure all belong to at least one subscription ID. If you login to the Azure Portal and search for subscription, it should show you what subscriptions you have. If you can provide the subscription ID that's associated with the resources in question, we can try to help.

10:56 p. m.
11:15 p. m.
why I need a subscriptions ? I only need to download my calendar events

11:22 p. m.
In that case, it might be best to involve our community experts. Could you pose your question here http://aka.ms/azadMSQA and send us the link? We'll escalate it internally and an expert should reply to you once they have a chance.

not-supported
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Jerryzy-MSFT avatar image
0 Votes"
Jerryzy-MSFT answered ·

Welcome to Microsoft Q&A forum.

The tag "csp-api" is used to discuss about Partner Center API related question, as this question is more relate to Microsoft Grap API . I suggest you could create a new thread in this forum:

MSDN Graph API Forum


·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

shashishailaj avatar image
1 Vote"
shashishailaj answered ·

Hello Pablo,

I will first summarize what I understand of your query. You seem to have created a simple azure AD free tenant. And created a user within the same tenant . After this you tried to register an application and provided consent for it using your global admin ID . And now you tried accessing you calendar Information for the user account.

If you were trying to use the user account pablo.martinez7908@gmail.com , then you would not be able to get the calendar for this user because in Azure AD the actual username for this object would be different and you would never be able to provision a mailbox for this . Its an account actually residing in Microsoft Account system (liveID system) rather than azure AD . Azure AD holds just the reference for it . So the actual username for this account would be pablo.martinez7908_gmail.com#EXT#@.onmicrosoft.com which you may not be using in postman to get the token.

If you have created a user with user@.onmicrosoft.com then you would not get calender information for this user because the user does not have the calendar service provisioned. You require a exchange online license assigned to the user in order for the user to be any calendar information present.

You mentioned that when you used the user created in AD (I am assuming on-premise AD) , the token was generated and you get a different error while accessing https://graph.microsoft.com/v1.0/me/calendars . I am assuming that the synced user from AD to Azure AD does not have a exchange online account associated with them and that's why you do not get calendar information.

I hope the above clarifies your query.

Now coming to your problem which you have mentioned earlier that you want to connect your calendar with a windows service in .net C# code. I am not sure if we have a ready made sample for the same but you can check this one . If you want to test this I would suggest you to go to Office dev Center https://developer.microsoft.com/en-us/office sign up for developer tenant which is free for limited period and will also provide you with Office 365 E3 dev licenses. You can use this license to provision the calendar of any test user by assigning test E3 dev license in your O365 Dev environment . Once this is done the calendar provisioning will happen. Also you would need to provide your application registered in Azure AD calendar.read permission in Graph API


I hope the answer helps . If the information provided in this answer helps you , please feel free to mark it as answer so that it is helpful to other members of the community. If you have any other queries related to this or if you feel we have misunderstood your query. Please do provide dtails in comments and we will look into this.

Thank you.

·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.