Independentsoft
Home
Products
Purchase
Support
Downloads
Company
Contact
Graph .NET
>
Tutorial
> Create daily recurring appointment
The following example shows you how to create a daily recurring appointment.
C# example
using System; using System.Threading.Tasks; using Independentsoft.Graph; using Independentsoft.Graph.Calendars; namespace Sample { class Program { static async Task Main(string[] args) { try { GraphClient client = new GraphClient(); client.ClientId = "67cb3333-209e-454e-b7bd-55a4d201270f"; client.Tenant = "independentsoft.onmicrosoft.com"; client.Username = "info@independentsoft.onmicrosoft.com"; client.Password = "password"; RecurrencePattern pattern = new RecurrencePattern(); pattern.Interval = 1; pattern.Type = RecurrencePatternType.Daily; RecurrenceRange range = new RecurrenceRange(); range.Type = RecurrenceRangeType.EndDate; range.StartDate = new DateTime(2021, 1, 1); range.EndDate = new DateTime(2021, 12, 31); range.RecurrenceTimeZone = "UTC"; Event appointment = new Event(); appointment.Recurrence = new Recurrence(pattern, range); appointment.Subject = "Development meeting every day"; appointment.Body = new ItemBody("
Meeting description
", ContentType.Html); appointment.Start = new DateTimeTimeZone(DateTime.Today.AddHours(8), "UTC"); appointment.End = new DateTimeTimeZone(DateTime.Today.AddHours(9), "UTC"); Event createdAppointment = await client.CreateEvent(appointment); Console.WriteLine("Id = " + createdAppointment.Id); Console.Read(); } catch (GraphException ex) { Console.WriteLine("Error: " + ex.Code); Console.WriteLine("Message: " + ex.Message); Console.Read(); } } } }