protected void Page_Load(object sender, EventArgs e)
     {
         NetworkCredential credential = new NetworkCredential("username", "password");
         Service service = new Service("https://myserver/ews/Exchange.asmx", credential);
     try
     {
         IsGreaterThanOrEqualTo restriction1 = new IsGreaterThanOrEqualTo(AppointmentPropertyPath.StartTime, DateTime.Today);
         IsLessThanOrEqualTo restriction2 = new IsLessThanOrEqualTo(AppointmentPropertyPath.EndTime, DateTime.Today.AddDays(1));
         And restriction3 = new And(restriction1, restriction2);
         FindItemResponse response = service.FindItem(StandardFolder.Calendar, AppointmentPropertyPath.AllPropertyPaths, restriction3);
         for (int i = 0; i < response.Items.Count; i++)
         {
             if (response.Items[i] is Appointment)
             {
                 Appointment appointment = (Appointment)response.Items[i];
                 lblSubject.Text = "Subject = " + appointment.Subject;
                 lblStartTime.Text = "StartTime = " + appointment.StartTime;
                 lblEndTime.Text = "EndTime = " + appointment.EndTime;
                 lblBodyPreview.Text = "Body Preview = " + appointment.BodyPlainText;
                 
             }
         }
         
     }
     catch (ServiceRequestException ex)
     {
         lblError.Text= "Error: " + ex.Message;
         lblXmlError.Text = "Error: " + ex.XmlMessage;
         Console.Read();
     }
     catch (WebException ex)
     {
         lblWebError.Text = "Error: " + ex.Message;
     }
 }
        /// <summary>
        /// Gets the search filter instance.
        /// </summary>
        /// <param name="localName">Name of the local.</param>
        /// <returns></returns>
        private static SearchFilter GetSearchFilterInstance(string localName)
        {
            SearchFilter searchFilter;

            switch (localName)
            {
            case XmlElementNames.Exists:
                searchFilter = new Exists();
                break;

            case XmlElementNames.Contains:
                searchFilter = new ContainsSubstring();
                break;

            case XmlElementNames.Excludes:
                searchFilter = new ExcludesBitmask();
                break;

            case XmlElementNames.Not:
                searchFilter = new Not();
                break;

            case XmlElementNames.And:
                searchFilter = new SearchFilterCollection(LogicalOperator.And);
                break;

            case XmlElementNames.Or:
                searchFilter = new SearchFilterCollection(LogicalOperator.Or);
                break;

            case XmlElementNames.IsEqualTo:
                searchFilter = new IsEqualTo();
                break;

            case XmlElementNames.IsNotEqualTo:
                searchFilter = new IsNotEqualTo();
                break;

            case XmlElementNames.IsGreaterThan:
                searchFilter = new IsGreaterThan();
                break;

            case XmlElementNames.IsGreaterThanOrEqualTo:
                searchFilter = new IsGreaterThanOrEqualTo();
                break;

            case XmlElementNames.IsLessThan:
                searchFilter = new IsLessThan();
                break;

            case XmlElementNames.IsLessThanOrEqualTo:
                searchFilter = new IsLessThanOrEqualTo();
                break;

            default:
                searchFilter = null;
                break;
            }
            return(searchFilter);
        }
        public void Match_if_equal()
        {
            var isLessThanOrEqualTo = new IsLessThanOrEqualTo <int>(8);

            var matches = isLessThanOrEqualTo.Matches(8);

            Assert.IsTrue(matches);
        }
        public void No_match_if_not_less()
        {
            var lessThanOrEqualTo = new IsLessThanOrEqualTo <int>(8);

            var matches = lessThanOrEqualTo.Matches(9);

            Assert.IsFalse(matches);
        }
        public void No_match_if_not_less()
        {
            var lessThanOrEqualTo = new IsLessThanOrEqualTo<int>(8);

            var matches = lessThanOrEqualTo.Matches(9);

            Assert.IsFalse(matches);
        }
        public void Match_if_equal()
        {
            var isLessThanOrEqualTo = new IsLessThanOrEqualTo<int>(8);

            var matches = isLessThanOrEqualTo.Matches(8);

            Assert.IsTrue(matches);
        }
 /// <summary>
 /// Gets the search filter instance.
 /// </summary>
 /// <param name="localName">Name of the local.</param>
 /// <returns></returns>
 private static SearchFilter GetSearchFilterInstance(string localName)
 {
     SearchFilter searchFilter;
     switch (localName)
     {
         case XmlElementNames.Exists:
             searchFilter = new Exists();
             break;
         case XmlElementNames.Contains:
             searchFilter = new ContainsSubstring();
             break;
         case XmlElementNames.Excludes:
             searchFilter = new ExcludesBitmask();
             break;
         case XmlElementNames.Not:
             searchFilter = new Not();
             break;
         case XmlElementNames.And:
             searchFilter = new SearchFilterCollection(LogicalOperator.And);
             break;
         case XmlElementNames.Or:
             searchFilter = new SearchFilterCollection(LogicalOperator.Or);
             break;
         case XmlElementNames.IsEqualTo:
             searchFilter = new IsEqualTo();
             break;
         case XmlElementNames.IsNotEqualTo:
             searchFilter = new IsNotEqualTo();
             break;
         case XmlElementNames.IsGreaterThan:
             searchFilter = new IsGreaterThan();
             break;
         case XmlElementNames.IsGreaterThanOrEqualTo:
             searchFilter = new IsGreaterThanOrEqualTo();
             break;
         case XmlElementNames.IsLessThan:
             searchFilter = new IsLessThan();
             break;
         case XmlElementNames.IsLessThanOrEqualTo:
             searchFilter = new IsLessThanOrEqualTo();
             break;
         default:
             searchFilter = null;
             break;
     }
     return searchFilter;
 }
Example #8
0
 private static ConditionResult VerifyCondition(List <object> objects, IsLessThanOrEqualTo cond)
 {
     return(ConvertToValueConditionAndVerify(objects, cond));
 }