2011-06-14 4 views
1

service.FindItems 메서드를 사용하여 Exchange 서버에서 약속을 가져오고 되풀이 약속을 반환하지 않습니다. 되풀이 항목의 첫 번째 인스턴스를 반환하지만 그 이후에는 더 이상 약속을 반환하지 않으며 IsRecurring은 약속에서 거짓으로 설정됩니다. 어떤 아이디어가 많이 주시면 감사하겠습니다되풀이 약속을 검색하는 방법

private void loadUsersAppointments(string user, int rscID) 
    { 
     // Add a search filter that searches on the body or subject. 
     List<SearchFilter> searchFilterCollection = new List<SearchFilter>(); 
     searchFilterCollection.Add(new SearchFilter.IsGreaterThan(AppointmentSchema.Start, DateTime.Today.AddDays(-7))); 

     // Create the search filter. 
     SearchFilter searchFilter = new SearchFilter.SearchFilterCollection(LogicalOperator.Or, searchFilterCollection.ToArray()); 

     CalendarView V = new CalendarView(DateTime.Today.AddDays(-7), DateTime.Today.AddMonths(1), 1000); 
     V.PropertySet = new PropertySet(BasePropertySet.IdOnly, AppointmentSchema.Subject, AppointmentSchema.Start, AppointmentSchema.End); 
     V.Traversal = ItemTraversal.Shallow; 

     // Create a view with a page size of 50. 
     ItemView view = new ItemView(10000); 

     // Identify the Subject and DateTimeReceived properties to return. 
     // Indicate that the base property will be the item identifier 
     view.PropertySet = new PropertySet(BasePropertySet.IdOnly, AppointmentSchema.Subject, AppointmentSchema.Start, AppointmentSchema.End); 

     // Order the search results by the DateTimeReceived in descending order. 
     view.OrderBy.Add(AppointmentSchema.Start, SortDirection.Descending); 

     // Set the traversal to shallow. (Shallow is the default option; other options are Associated and SoftDeleted.) 
     view.Traversal = ItemTraversal.Shallow; 

     // Send the request to search the Inbox and get the results. 
     ExchangeService service = GlobalFunc.ElevateGetBinding(); 
     service.ImpersonatedUserId = new ImpersonatedUserId(ConnectingIdType.SmtpAddress, user+"@works.local"); 
     FindItemsResults<Item> findResults = service.FindItems(WellKnownFolderName.Calendar, searchFilter, view); 

     List<Item> items = new List<Item>(); 
     foreach (Microsoft.Exchange.WebServices.Data.Appointment appointment in findResults) 
     { 
      items.Add(appointment); 
     } 
     service.LoadPropertiesForItems(items, PropertySet.FirstClassProperties); 

     // Process each item. 
     foreach (Microsoft.Exchange.WebServices.Data.Appointment myItem in items) 
     { 
      DevExpress.XtraScheduler.Appointment AddAppt = new DevExpress.XtraScheduler.Appointment(); 

      try { 
       if (myItem.Subject.StartsWith("Advisor Appointment")) 
        AddAppt.LabelId = 8; 
       else 
        AddAppt.LabelId = 2; 
       AddAppt.Subject = myItem.Subject; 
      } 
      catch { } 
      try 
      { 

      } 
      catch (Exception ex) { MessageBox.Show(ex.Message); } 
      try { AddAppt.Start = myItem.Start; } 
      catch { } 
      try { AddAppt.Description = myItem.Body; } 
      catch { } 
      try { AddAppt.End = myItem.End; } 
      catch { } 
      AddAppt.ResourceId = rscID; 




      schStorage.Appointments.Add(AddAppt); 
     } 
    } 

:

는 코드입니다.

감사합니다.

답변

0

되풀이 약속을 얻으려면 CalendarView를 사용해야합니다. 되풀이 약속 인스턴스는 Exchange 데이터베이스의 실제 항목이 아닙니다. 대신 Exchange는 특정 시간 범위를 쿼리 할 때 가상 항목을 즉석에서 만듭니다.

관련 문제