Please have look into this document-
1.https://learn.microsoft.com/en-us/graph/api/user-post-events?view=graph-rest-1.0&tabs=csharp
2.https://learn.microsoft.com/en-us/graph/sdks/choose-authentication-providers?tabs=csharp
3.https://learn.microsoft.com/en-us/graph/sdks/sdk-installation
Calling API to create an event, What am I doing wrong?
Hello there
I've been trying to call Microsoft Graph API for creating events, however I've not been able to do it.
Context: I have a Web MVC application (C#) already in production, with the "common" authentication method, reading a database of users. Recently the customer asked me the possibility to create Microsoft Teams Meetings from the application and also those created meetings have to be scheduled in the Microsoft Teams Calendar with the "Join" button to enter the meeting.
I already configured the API permissions, client secret and used the other properties like tenant, user id, etc from the Azure Portal, I'm sharing screenshots of my code and configuration. I'm doing the "Get access on behalf of a user" process.
API Permissions:
Taking the example of the authorize endpoint from the docs, of course I'm replacing the values with my own info
https://login.microsoftonline.com/{tenant}/oauth2/v2.0/authorize?
client_id=11111111-1111-1111-1111-111111111111
&response_type=code
&redirect_uri=http%3A%2F%2Flocalhost%2Fmyapp%2F
&response_mode=query
&scope=offline_access%20user.read%20mail.read
&state=12345
Here is my code to Receive the code once the user authorizes the permissions, I'm just storing the value in a static class for testing
Once I got the Auth code, I'm using it to create the event with the generated token, also I already verified that the token contains the permissions given in the Azure Portal.
This is the input for the /events endpoint, is too long that's why I'm taking a different screenshot
This is the complete method, for the json value, please see the json above this screenshot. I also tried with the "me" url but it does not work either.
I'm able to the get the token, but when trying to create the event returns the next response.
Am I missing something? Maybe the wrong endpoint?
Please, help.
Thanks in advance.
Microsoft Teams Development
Microsoft Security Microsoft Graph
1 answer
Sort by: Most helpful
-
Sayali-MSFT 3,991 Reputation points Microsoft External Staff Moderator
2023-07-28T10:16:52.3833333+00:00