2014-01-15 29 views
0

是否有一種方法可以搜索所有用戶的日曆(全部位於通訊組中)並僅顯示會議,它們是oranizers的會議?僅顯示用戶是EWS組織者的會議

我正在使用模擬。

用下面的代碼,我可以得到一個會議的組織者:

 //Instantiate the ExchangeService class+ Exchange Certificate Validation + Imparsonate 
     ServicePointManager.ServerCertificateValidationCallback = CertificateValidationCallBack; 
     ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP2); 
     service.Credentials = new NetworkCredential("user", "password", "domain"); 
     service.AutodiscoverUrl("[email protected]", RedirectionUrlValidationCallback); 

     //Distinguish Distribution Group 
     string distributiongroup = "[email protected]"; 

     // Initialize values for the start and end time. 
     DateTime startDate = DateTime.Now.AddMinutes(0); 
     DateTime endDate = startDate.AddDays(1); 

     //Extend the distribution group 
     ExpandGroupResults distGroupMembers = service.ExpandGroup(distributiongroup); 
     foreach (EmailAddress address in distGroupMembers.Members) 
     { 
      //Impersonate each distribution group member 
      service.ImpersonatedUserId = new ImpersonatedUserId(ConnectingIdType.SmtpAddress, address.Address); 

      // Execute the search in the calendar folder and return the view 
      CalendarView caledarView = new CalendarView(startDate, endDate); 
      caledarView.PropertySet = new PropertySet(BasePropertySet.FirstClassProperties); 
      FindItemsResults<Appointment> apt = service.FindAppointments(WellKnownFolderName.Calendar, caledarView); 

      foreach (Item item in apt.Items) 
      { 
       ServiceResponseCollection<GetItemResponse> myColl = service.BindToItems(new[] { new ItemId(item.Id.UniqueId) }, caledarView.PropertySet); 
       foreach (GetItemResponse temp in myColl) 
       { 
        Appointment app = (Appointment)temp.Item; 

        string organizator = app.Organizer.Address; 

        Console.WriteLine(address + "\n" + app.Subject + " " + organizator); 
       } 
      } 

我的目標是讓只爲每一位用戶,他是組織者的會議。

你能幫我一下嗎?

親切的問候 Xristos

+0

什麼關於這個問題你的問題/問題? – Marshall777

+0

我只想列出用戶是組織者的約會。 – user3197311

+0

您可以構建一個包含Appointment對象的列表,然後使用LINQ查詢獲取您想要的約會,即使我承認這不是一個真正的解決方案。 – Marshall777

回答

0
if (organizator == address.Address) 

{ 「有所作爲」 }

相關問題