Independentsoft
- any library, any programming language
Home
Purchase
Support
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.Users; using Independentsoft.Graph.Calendars; namespace Sample { class Program { static async Task Main(string[] args) { try { GraphClient client = new GraphClient(); client.ClientId = "63333333-209e-454e-b7bd-55a4d201270f"; client.Tenant = "independentsoft.onmicrosoft.com"; client.ClientSecret = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; RecurrencePattern pattern = new RecurrencePattern(); pattern.Interval = 1; pattern.Type = RecurrencePatternType.Daily; RecurrenceRange range = new RecurrenceRange(); range.Type = RecurrenceRangeType.EndDate; range.StartDate = new DateTime(2023, 1, 1); range.EndDate = new DateTime(2023, 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, new UserId("info@independentsoft.onmicrosoft.com")); Console.WriteLine("Id = " + createdAppointment.Id); Console.Read(); } catch (GraphException ex) { Console.WriteLine("Error: " + ex.Code); Console.WriteLine("Message: " + ex.Message); Console.Read(); } } } }
VB example
Imports Independentsoft.Graph Imports Independentsoft.Graph.Users Imports Independentsoft.Graph.Calendars Namespace Sample Class Module1 Shared Sub Main(ByVal args As String()) Dim task = New Task(AddressOf Run) ' Start and wait for task to end. task.Start() Console.Read() End Sub Shared Async Sub Run() Try Dim client As GraphClient = New GraphClient() client.ClientId = "63333333-209e-454e-b7bd-55a4d201270f" client.Tenant = "independentsoft.onmicrosoft.com" client.ClientSecret = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" Dim pattern As RecurrencePattern = New RecurrencePattern() pattern.Interval = 1 pattern.Type = RecurrencePatternType.Daily Dim range As RecurrenceRange = New RecurrenceRange() range.Type = RecurrenceRangeType.EndDate range.StartDate = New DateTime(2023, 1, 1) range.EndDate = New DateTime(2023, 12, 31) range.RecurrenceTimeZone = "UTC" Dim appointment As [Event] = 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") Dim createdAppointment As [Event] = Await client.CreateEvent(appointment, New UserId("info@independentsoft.onmicrosoft.com")) Console.WriteLine("Id = " & createdAppointment.Id) Catch ex As GraphException Console.WriteLine("Error: " + ex.Code) Console.WriteLine("Error: " + ex.Message) Console.Read() End Try End Sub End Class End Namespace
Need help? Ask our developers:
Name*
Email*
Message*