public static void Run()
        {
            // ExStart:ListTasksFromExchangeServerWithEWS
            // Set mailboxURI, Username, password, domain information
            string            mailboxUri  = "https://ex2010/ews/exchange.asmx";
            string            username    = "******";
            string            password    = "******";
            string            domain      = "ex2010.local";
            NetworkCredential credentials = new NetworkCredential(username, password, domain);
            IEWSClient        client      = EWSClient.GetEWSClient(mailboxUri, credentials);

            //Listing Tasks from Server
            client.TimezoneId = "Central Europe Standard Time";
            TaskCollection taskCollection = client.ListTasks(client.MailboxInfo.TasksUri);

            //print retrieved tasks' details
            foreach (ExchangeTask task in taskCollection)
            {
                Console.WriteLine(client.TimezoneId);
                Console.WriteLine(task.Subject);
                Console.WriteLine(task.StartDate);
                Console.WriteLine(task.DueDate);
            }

            //Listing Tasks from server based on Query - Completed and In-Progress
            ExchangeQueryBuilder builder = new ExchangeQueryBuilder();

            ExchangeTaskStatus[] selectedStatuses = new ExchangeTaskStatus[]
            {
                ExchangeTaskStatus.Completed,
                ExchangeTaskStatus.InProgress
            };
            builder.TaskStatus.In(selectedStatuses);

            MailQuery query = builder.GetQuery();

            taskCollection = client.ListTasks(client.MailboxInfo.TasksUri, query);

            //print retrieved tasks' details
            foreach (ExchangeTask task in taskCollection)
            {
                Console.WriteLine(client.TimezoneId);
                Console.WriteLine(task.Subject);
                Console.WriteLine(task.StartDate);
                Console.WriteLine(task.DueDate);
            }
            //ExEnd:ListTasksFromExchangeServerWithEWS
        }
        public static void Run()
        {
            try
            {
                // Set mailboxURI, Username, password, domain information
                string            mailboxUri  = "https://ex2010/ews/exchange.asmx";
                string            username    = "******";
                string            password    = "******";
                string            domain      = "ex2010.local";
                NetworkCredential credentials = new NetworkCredential(username, password, domain);
                IEWSClient        client      = EWSClient.GetEWSClient(mailboxUri, credentials);

                // ExStart:SpecifyTimeZoneForExchange
                client.TimezoneId = "Central Europe Standard Time";
                // ExEnd:SpecifyTimeZoneForExchange

                // Listing Tasks from Server
                TaskCollection taskCollection = client.ListTasks(client.MailboxInfo.TasksUri);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }