Independentsoft
- any library, any programming language
Home
Purchase
Support
Company
Contact
WebDAV .NET for Exchange
>
Tutorial
> Create recurring task
The following example shows you how to create daily recurring task.
C# example
using System; using System.Net; using Independentsoft.Webdav.Exchange; using Independentsoft.Webdav.Exchange.ContentClass; using Independentsoft.Webdav.Exchange.Recurrence; namespace Sample { class Program { static void Main(string[] args) { NetworkCredential credential = new NetworkCredential("username", "password"); WebdavSession session = new WebdavSession(credential); session.UserMailbox = "https://myserver/exchange/emailaddress"; Resource resource = new Resource(session); DateTime startDate = DateTime.Today.AddHours(22); DateTime endDate = DateTime.Today.AddHours(23); TaskRecurrencePattern pattern = new TaskRecurrencePattern(); pattern.Interval = 1; pattern.RecurrenceType = RecurrenceType.Daily; pattern.PatternStartDate = startDate; Task task1 = new Task(); task1.Subject = "MyTask"; task1.StartDate = startDate; task1.CommonStart = startDate; task1.DueDate = endDate; task1.CommonEnd = endDate; task1.IsComplete = false; task1.IsRecurring = true; task1.RecurrencePattern = pattern; task1.Body = "Body text."; resource.CreateItem(task1); } } }
VB example
Imports System Imports System.Net Imports Independentsoft.Webdav.Exchange Imports Independentsoft.Webdav.Exchange.ContentClass Imports Independentsoft.Webdav.Exchange.Recurrence Namespace Sample Class Program Shared Sub Main(ByVal args As String()) Dim credential As New NetworkCredential("username", "password") Dim session As New WebdavSession(credential) session.UserMailbox = "https://myserver/exchange/emailaddress" Dim resource As New Resource(session) Dim startDate As DateTime = DateTime.Today.AddHours(22) Dim endDate As DateTime = DateTime.Today.AddHours(23) Dim pattern As New TaskRecurrencePattern() pattern.Interval = 1 pattern.RecurrenceType = RecurrenceType.Daily pattern.PatternStartDate = startDate Dim task1 As New Task() task1.Subject = "MyTask" task1.StartDate = startDate task1.CommonStart = startDate task1.DueDate = endDate task1.CommonEnd = endDate task1.IsComplete = False task1.IsRecurring = True task1.RecurrencePattern = pattern task1.Body = "Body text." resource.CreateItem(task1) End Sub End Class End Namespace