using Microsoft.Graph; using Microsoft.Identity.Client; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Configuration; using System.Linq; using System.Net.Http; using System.Net.Http.Formatting; using System.Net.Http.Headers; using System.Text; using System.Threading.Tasks; using Microsoft.Owin.Security.OAuth; using Microsoft.Graph.Auth; using TeamAPIHelper.Token; namespace TeamAPIHelper { class Program { static HttpClient client = new HttpClient(); static string clientId = "4760c575-cb7f-4a13-9766-788faf3b08f0"; static string clientSecret = "z8.Q79S-T~.bFVyxzDvq1.qz12xvB2usv0"; static string scopes = "https://graph.microsoft.com/.default"; static string tenantID = "4e7ebf6c-023b-4c00-ba80-0bd89fa28b69"; static void Main(string[] args) { CreateMeeting().Wait(); } public static async Task CreateMeeting() { try { GraphServiceClient graphClient = new GraphServiceClient(CreateAuthProvider()); OnlineMeeting createNewOnlineMeeting = new OnlineMeeting() { StartDateTime = DateTime.Now.AddMinutes(20), EndDateTime = DateTime.Now.AddMinutes(45), Subject = "Testing Online meeting via console" }; var onlineMeeting = await graphClient.Me.OnlineMeetings .Request() .AddAsync(createNewOnlineMeeting); } catch (Exception ex) { Console.WriteLine(ex.Message); } } public static IAuthenticationProvider CreateAuthProvider() { IConfidentialClientApplication confidentialClientApplication = ConfidentialClientApplicationBuilder .Create(clientId) .WithTenantId(tenantID) .WithClientSecret(clientSecret) .Build(); ClientCredentialProvider authProvider = new ClientCredentialProvider(confidentialClientApplication); return authProvider; } } }